You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a login page, I do user login and session operation in an action handler, and I check the login state in the loader of all other pages. While I finish the session and redirect to the user home, the home page seems to be caching the old state where the user is not logged in.
https://reactrouter.com/en/main/hooks/use-revalidator
Looking at the revalidator docs, it mentioned that useSubmit would trigger a reload, but that happens too early, as the authentication logic is inside the action which comes after the useSubmit. On the other hand, I cannot use the useRevalidator as it is a React hook and apparently I cannot invoke a react hook inside action.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In a login page, I do user login and session operation in an action handler, and I check the login state in the loader of all other pages. While I finish the session and redirect to the user home, the home page seems to be caching the old state where the user is not logged in.
https://reactrouter.com/en/main/hooks/use-revalidator
Looking at the revalidator docs, it mentioned that useSubmit would trigger a reload, but that happens too early, as the authentication logic is inside the action which comes after the useSubmit. On the other hand, I cannot use the useRevalidator as it is a React hook and apparently I cannot invoke a react hook inside action.
What should I do now?
Beta Was this translation helpful? Give feedback.
All reactions