router.invalidate() and auth history navigation
Hi all! I was trying out some auth patterns and came across this situation where:
1. A user is signed in at
2. The user navigates to
3. The user signs out
4. The user history navigates back to
(only
5. If the user history navigates forward to
I’m definitely missing something here and was looking for some insight into how to best solve this (maybe editing bfcache related settings? client-side effect?). Route example code in the comments below.
1. A user is signed in at
/dashboard2. The user navigates to
/3. The user signs out
4. The user history navigates back to
/dashboard/dashboard’s beforeLoad runs but__root's beforeLoad runs) - we are still served the cached authenticated version of the route, meaning one might get a glimpse of authenticated content post sign out (the inverse flow of signing in and navigating back to an auth route will also serve the non-authed version first). 5. If the user history navigates forward to
/ : the user is now signed out, but if we don't call router.navigate({ reloadDocument: true }) on sign out, the authed version of index, with the sign out button, will be servedI’m definitely missing something here and was looking for some insight into how to best solve this (maybe editing bfcache related settings? client-side effect?). Route example code in the comments below.