Page focuced and mounted Triggered twice when launching app

I think this is a bug when opening my web app, sometimes (most of the times) page mounted and focused, get triggered twice (in a matter of seconds) i think only when automatically logging in a user

I dont know if thats related, but i have noticed, that when you launch the distributed app from the url it automatically goes to when automatically signing in Maybe thats why the events get triggered twice BUT i dont think thats the case, in preview because, in the preview, the second time gets triggered, before the auto sign in process is completed (to tell you the truth i havent tested that with the distributed app)

1 Like

Try in an incognito browser, I found some issues occur with caching.

Also add some toast and dialogue in too, so you have more visible feedback.

Hi there
this is how i found about the problem in the first place using toasts, as for the incognito browser, i will look more into it and report But in that case its something need to be fixed i suppose…

Add in a few delay nodes of 5 seconds as well. It will help you pin-point when its happening.

No one else knows your app as well as you do, so its always hard for someone else to spot the issue. To help people, provide screen shots of the logic in place.

Good luck!

1 Like

yeah for sure, I mainly made the post, to figure out, whether or not its a BUG that someone else has spotted, as for the fact that maybe its something that i have done wrong, as you said, i will more into it
Thanks again

1 Like

If you have a default page set in AG, then the app open will open the default page AND it will do the redirect you setup.

1 Like

So does this mean that the fact that is triggered twice, means that the page that i have chosen, is the default and i can remove it as the preferred one? and it will work the same?

I’m not sure what the correct answer is, but I kept the set initial page and got rid of my initial page redirect. Fixed the issue.

can you please show from where you “got rid of my initial page redirect”?

If you don’t run any open/replace page flow functions on Global Canvas for app load/open, then AG will by default open the page you’ve set as the first/main/home page.

ohh thats what you mean no i dont have any kind of open page logic, it just lands in the default first page but the logic triggers twice

Hmm in a plain app I don’t get such a double trigger on the initial page at least in a plain new app on an empty page, so this has something to do with your more specific setup. If you want to debug it I recommend doing some of the steps suggested above, but if you want to just get rid of it or avoid it, use debounce flow function right after page focused/mounted before any other logic to prevent logic from firing multiple times.

On a personal note, I tend to love to use debounce everywhere to prevent e.g. double clicks on buttons/navigation items etc.

Ohh my god!! feel free to laugh, all this time, in order to achieve this i was using variable and logic, :shushing_face:
guess my plans for this afternoon

1 Like

The same!! A new function that will simplify loads of clunky logic.

1 Like