Using useRevalidator's revalidate function and destroyed sessions
#5933
-
|
I've got a problem where a user might logout in one tab, but another tab might have the app in a still logged in state. I'm using cookie sessions so when they log out, the session cookie disappears. If I trigger a I'm getting this to behave how I want it to by calling |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Are you using So it's most likely a browser issue. With another session storage it wouldn't be an issue because the session data on your storage (e.g. the DB) will not exists anymore. Have you tried using Broadcast Channel API instead? This way, when the user finish the logout on one tab it will send a message to other tabs and trigger a revalidation, instead of waiting for the user to switch to the tab, risking a race condition between the logout and the revalidation. |
Beta Was this translation helpful? Give feedback.
Are you using
createCookieSessionStorage? I think what's probably happening is that the first revalidate sent the Cookie, because it's still there, and the second one doesn't send it anymore because.So it's most likely a browser issue. With another session storage it wouldn't be an issue because the session data on your storage (e.g. the DB) will not exists anymore.
Have you tried using Broadcast Channel API instead? This way, when the user finish the logout on one tab it will send a message to other tabs and trigger a revalidation, instead of waiting for the user to switch to the tab, risking a race condition between the logout and the revalidation.