Screen Start, Screen Open and Variable Change event sequence

@domhnallohanlon, @wei,

Since the CLOUD variables are much easier to use than the Firebase GET and SAVE block, I wanted to see if the WHEN…INITILIZES OR CHANGES block could be used in place of the Firebase listener. I built an little app to track the screen START, screen OPEN, and WHEN…INITILIZES OR CHANGES for a CLOUD, STORED, and APP variable.

The cloud variable WHEN…INITILIZES OR CHANGES occurs on start up and when the variable changes (as I would hope). The STORED and APP variable WHEN…INITILIZES OR CHANGES occur not only when they change, but every time a screen opens. I’ve uploaded a screen capture in the zip file demonstrating the the out of my simple app Thunkable

First Time Load

Screen1StartBegin1607944674.356
MyApp1ChangeBegin1607944674.356
MyStored1ChangeBegin1607944674.356
Screen1OpenBegin1607944674.366
Screen1StartLoop11607944674.465
MyApp1ChangeLoop11607944674.473
MyStored1ChangeLoop11607944674.479
Screen1OpenLoop11607944674.485
Screen1StartLoop21607944674.577
MyApp1ChangeLoop21607944674.59
MyStored1ChangeLoop21607944674.595
Screen1OpenLoop21607944674.602
MyCloud1ChangeBegin1607944674.677
Screen1StartLoop31607944674.686
MyApp1ChangeLoop31607944674.697
MyStored1ChangeLoop31607944674.704
Screen1OpenLoop31607944674.709
MyCloud1ChangeLoop11607944674.784
Screen1StartComplete41607944674.795
MyApp1ChangeComplete41607944674.803
MyStored1ChangeComplete41607944674.81
Screen1OpenComplete41607944674.815
MyCloud1ChangeLoop21607944674.889
MyCloud1ChangeLoop31607944674.998
MyCloud1ChangeComplete41607944675.116

Second Time Load (after switching to another screen)

Screen2StartBegin1607944703.126
MyApp2ChangeBegin1607944703.126
MyStored2ChangeBegin1607944703.126
Screen2StartLoop11607944703.235
MyApp2ChangeLoop11607944703.239
MyStored2ChangeLoop11607944703.246
Screen2StartLoop21607944703.341
MyApp2ChangeLoop21607944703.348
MyStored2ChangeLoop21607944703.355
Screen2StartLoop31607944703.447
MyApp2ChangeLoop31607944703.456
MyStored2ChangeLoop31607944703.464
Screen2OpenBegin1607944703.499
Screen2StartComplete41607944703.553
MyApp2ChangeComplete41607944703.562
MyStored2ChangeComplete41607944703.57
Screen2OpenLoop11607944703.606
Screen2OpenLoop21607944703.711
Screen2OpenLoop31607944703.816
Screen2OpenComplete41607944703.927

Notice that the Screen start event occurs every time the screen opens, not just the first time.

Additionally, the cloud variable change event only occurs when the app is first started, but the APP and STORED variable change events occur every time the screen opens. So in a multi screen app, the variable change event occurs every time there is a switch from one screen to the next

ChangeDataSimple - Google Chrome 2020-12-14 03-13-46_Trim.zip (3.5 MB)

If I add a Top Tab to encapsulate my 2 screens, the behavior changes again. Now the STORED and APP INITILIZES OR CHANGES occur when the screen first loads, and then only when the variables change.The cloud INITILIZES OR CHANGES events occur on both screen when the cloud variable is changed. Interestingly, it occurs twice on the starting screen.(EDIT: Apparently the screen becase corrupted and has some sort of phantom event that I cannot delete causing the second change event) The start events do not occur when switching between screens.
https://x.thunkable.com/copy/4d42fd9d42e7db3f65185ebf44d09ca7

here is a link to the long video of the top tab version demonstration.

At the end of the day, it would be nice to have some sort of list or chart showing when these asynchronous events occur so we can manage our apps accordingly.

Thanks and Happy Thunking

1 Like

I believe @eddie.rebehy had a go at the same subject a while ago arriving to similar results as yours @drted.

Firing events of screen start and open seems to take different behaviour when using the device keys than using navigation component keys.

2 Likes