MainView loaded twice

Here shows the debug log of my testing, where the logging statement is placed in the constructor of the MainView.uno.

file

It seems that MainView.ux has been loaded for twice upon running.

Actually I am not sure whether it is a bug or not as it should not significantly affect the performance. However, in my case, I call a function in the constructor which adds items to a list within another class. As the constructor has been called for two times, the list results in twice the number of items. May I know will this be fixed?

Thanks!

It also happens to me.

This is still happening all the time, sometimes even 3 instances are running in parallel

simple way to expose:

  <JavaScript>
          console.log("hello");
    </JavaScript>

Hi!

Is this in exported mode? When you export your app as a final app, the code should only run once.

In preview mode however, your object graph can be initialized many times, i.e. every time you make a change to UX and JS. The simulator might do some excessive updates during init. This should not be a problem though, however I’ve added an internal issue to get this investigated.

Thanks for reporting.

It’s in preview mode. It’s normally no big deal, it is only a small hassle in my case because my app tries to sign in to the server when it starts up, and so it’s random whether the instance that is actually visible is the one that is let in. I have a workaround though.

Hi Anders, this is still happening now.
It’s probably more complicated than this, but if the problem is the multiple file save/check the trivial fix would be to debounce the compilation by few milliseconds so that it starts only after last check.

It’s not a big deal but if you have few resource intensive tasks or REST calls at start up it makes them multiple times which is not nice.