Intercepted route still cached on navigate back
Answered
Red-legged Kittiwake posted this in #help-forum
Red-legged KittiwakeOP
I'm trying to use intercepted routes to implement auth logic.
On /home, there's a sign in button.
on click, it redirects to /sign-in, but the route is intercepted and appears as a modal
The user can click "sign-up" (not sign-in), and they are redirected to /sign-up (real route not intercepted).
If they navigate back to /sign-in, i send them to /sign-in-skip page (to avoid getting intercepted again).
The problem is now when I go back to home page, the sign-in modal is still there, even though the URL is /home. How should i implement this behavior without having these bugs?
see below for demo:
On /home, there's a sign in button.
on click, it redirects to /sign-in, but the route is intercepted and appears as a modal
The user can click "sign-up" (not sign-in), and they are redirected to /sign-up (real route not intercepted).
If they navigate back to /sign-in, i send them to /sign-in-skip page (to avoid getting intercepted again).
The problem is now when I go back to home page, the sign-in modal is still there, even though the URL is /home. How should i implement this behavior without having these bugs?
see below for demo:
9 Replies
Red-legged KittiwakeOP
oh i forgot to include a screenshot
this might help
the attached video above is a demo of the bug
Red-legged KittiwakeOP
should i just avoid intercepted routes in general? it seems like they are kinda buggy and hard to use. maybe that's just me tho
Red-legged KittiwakeOP
you know it's bad when google starts showing your own post 😂
Red-legged KittiwakeOP
fixed
it was because i used shadcn's dialog copmonent but with open={true}
setting it to use pathname fixed it
Red-legged KittiwakeOP
Answer