changing route with useNavigate() causes onMount() of the child route to be fired twice
Hey, i have a problem that i cant wrap my mind. When i load my Route in a new window/tab or with F5 the onMount() function of one of my children is only fired one. But when i use useNavigate(), then onMount() gets fired twice. Why could that be?
I am working on replicating the bug.
1 Reply
Okay the issue arises because of <Suspense>
Now when i click the buttons with onclick -> useNavigate(), the onMount() function of the subroutes gets executed twice. Any idea how to solve this?
Okay the problem was solved for me by usind <Show when={!ok.loading}> instead of Suspense. I still cant quite wrap my mind around it. Can someone hint me to resources to understand it?