Error during navigation
I have an error during navigation, possibly because of mishandling URL parameters by the router's
useSearch()
or useParams()
(but this is only a guess).
My problem is that the stack trace does not help at all, I attached a screenshot.
Do you have any ideas how can I track the real location of the error?
Thanks.
4 Replies
I just don't find any determinism in its behaviour 😦
Sometimes it works but most of the times it throws the above error.
The pages are fairly complex, so I cannot extract a minimal reproducer easily 😦
It seems I found it by experimenting and commenting out navigation-related code fragments. It took a long time 😦
I had
<Navigate>
components inside the fallback
parameter of Show
components on the problematic pages.
Removing the <Navigate>
fallbacks solved the problem.If you checked a signal of createResource or createAsync in the Show component maybe it would have helped to add the deferStream:true to the primitive.
The <Show> component uses a condition whether the page should be displayed at all (by validating parameters in the URL), or redirected to a fallback page using a <Navigate>.
Maybe this is not the best solution for redirecting to another page based on a condition?
I'd standardize on throwing
redirect
s in critical query
s instead of using useNavigate
and Navigate
.
If you warm the query
in the preload
the redirect will happen as soon as the first createAsync
tries to connect to it.