Page Variable not set to 'initial Value' every time

Did anyone else wonder about a pageVariable as well, that was not set to the supposed ‘initial Value’?

I ran into it, when testers reported inconsistent behaviour of a filter in my app. At first I couldn’t reproduce the error, because I just opened the page and played around.
But then it came to light, that the error occured, when going back and forth between the pages of the app. The pageVariable do not reset, when reopening a page. Instead, they keep the values from the previous time a page was opened.

Honestly, I’m not sure if it’s a bug or intended behaviour. In any case it surprised me and I opend a tracker report , so the development team might make a conscious decision about it.

What do you think?

This depends if you navigate to a new page with Flow function “Replace page” or “Open page”.

Blockquote Page variables exist in the context of a single page. When a page is removed from the navigation stack, its page variables are reset.

If you navigate with Replace page then you reset your navigation each time. Whereas Open page just adds new page on the top of the current stack.

2 Likes

Thanks a lot for your explanation and pointing towards the ‘Replace page’ flow function!

When testing the ‘Replace page’ function today, it came with the side effect, that the navigation bar in the ios preview app didn’t work anymore. Therefor I am going to stick with the ‘Open page’ flow function, but from now on will initialize the page variables by using the ‘Page mounted’ logic event and ‘Set page variable’ flow function.

1 Like