Session not always loading correctly

I am working on an application that uses the Perspective session heavily. I have inputs and labels that bind to session variables and sometime when loading a page I see the default values until I reload the page in which the session values are then loaded.

Has anyone else experienced this?

Where did you place the code to change/update the session values from their default to the new values you expect?

Uses in scripts. Here is a video of the issue I have censored company information with the red bars. I am navigating to a different screen and then back again. The cancel button is just calling system.perspective.navigate()

Thanks for the video, this helps tremendously. I think maybe you have some code on the onStartup or onPageStartup when you get to this main page...then when you navigate to add a defect and click cancel, the system.perspective.navigate() isn't going to call the onStartup or onPageStartup event again. Instead, your view should have parameters or custom properties that have binding to get the data you need to load the page. However, a full refresh (by swiping down) does reload the page and trigger the onStartup or onPageStartup. Again, one possibility...I can't see how you have your page set up in the designer.

Here is a screenshot of how one of those list items value is configured

I do have a startup script but it only sends an authCheck message to the AppBar and set the title in the AppBar

def runAction(self):
	system.perspective.sendMessage('authCheck')
	
	self.session.custom.mobile.title = self.session.custom.mobile.selectedSort.sort_number

and here is what the list item component/view looks like


Strange. Looks ok so far. Can you show what code you have on the Cancel button? You said system.perspective.navigate(), but are you trying to call back a view or page? try calling back the page and see if the items bind again. Worst case, you could force a re-bind.

The cancel button sends a cancelPartID message that is captured by the root view. I would like to emphasize that the way I have everything setup does work but only sometimes

def onMessageReceived(self, payload):
	system.perspective.navigate('/mobile/container-details')

Can you try using system.perspective.navigateBack() on the Cancel button to see if the issue is related to the .navigate() function. Maybe it is a bug that is hard to pinpoint because, as you said, it doesn't happen all the time.

I have changed that single navigate to navigateBack and I will see what happens but there are other places where I need to use navigate()

I've seen 5 times just this morning when testing where moving forward in the apps flow I saw the same default values instead of the session data

Did you solve the issue? If so, how?

Yea.... kinda....

I set my binding to an expression

now()

then added a transform script to return the session data that the bind was originally binding to.

At most it shows the default values for a second then populates the correct data