I’m currently working on an app that has a delay set to the “page mounted” logic in order to replace the page after 120 seconds. This functionality is present on every page within the app. However, I’m encountering an issue where my app is glitching, and I suspect it might be related to this implementation. For instance, when the user initially lands on Page 1, and then performs an action or clicks a button to navigate to Page 2, the app is expected to load Page 3 afterwards. However, in some cases, due to the 120-second delay and page replacement logic, the app navigates back to Page 1 instead of proceeding to Page 3.
Could someone please help me understand what I might be doing wrong, or suggest a more efficient approach to replace a page after a specific amount of time? Any advice or best practices for handling this type of functionality would be greatly appreciated.
Well, to be able to help you better I’d need to understand why you want to do this complicated replace logic? But my initial guess is that you could prevent double navigations by having an event for page unfocused or in buttons where you navigate away setting a page variable that you check before replacing the page
Hello Mevi, thank you for your response.
My use case involves a Parcel Locker Kiosk. This app will manage the functionality of a parcel locker and will be installed directly onto the community device. In case a resident or user fails to complete a transaction, I would like the page to expire and return to the homepage or welcome screen.
Additionally, I noticed another issue where the API endpoint that runs in the background of one of my pages never stops triggering even after the page has been replaced in the navigation stack. I suspect the same issues are causing my navigation to glitch.
I must be doing more than a few things wrong as regarding navigating from page to page. Any help is greatly appreciated!
This really depends on whether you are trying on mobile (which I assume you are) and whether or not you have several tabs or not. In some cases you might need to use navigate back, in some others replace page might work better. I made a simple example that works fine (but will navigate you out of the app in preview if you don’t press the button) in the attached project Mevi’s navigation back test.zip.gpg (105.0 KB)