Invalidating router+query auth for logout
Hi, I'm trying to implement logout and I'm noticing some odd behaviour when invalidating the router. The
beforeLoad
handler for the root seems to have updated while beforeLoad
for /dashboard
has not
browser console logs after logout
seems like it's not being merged properly.
I've created a min repro here: https://github.com/alakhpc/tss-test5 Replies
ambitious-aquaOP•11mo ago
you can see the console log when signing out here: https://tss-test.pages.dev
I would expect the
userId
to be null and redirect the user to the login pageflat-fuchsia•11mo ago
Hey @jepcd, that's because you're receiving the dashboard's context when beforeLoad re-runs
https://discord.com/channels/719702312431386674/1300114602251649096
flat-fuchsia•11mo ago
That's how I solved this

flat-fuchsia•11mo ago
I don't really update the "session" context prop, just update it's type
ambitious-aquaOP•10mo ago
ah that definitely fixed it. Thanks!