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
Now, the thing is, when I initially logged in and try to logout, it works fine. Protected route gets state update from redux slice and navigates user to redirectPath.
But when I click any react router link and try to logout after that, protected route does not rerender. It just stays on the same page, despite the fact that state got updated. I have to explicitly reload the page for it to work.
Also, when I do not split routes into multiple files and keep everything in one file, everything functions well.
Anyone has idea why it works like this?
Expected Behavior
Proctected route has to rerender and get update from redux.
Actual Behavior
Protected route does not rerender, but redux state is updated. It sees update only after refreshing page
This discussion was converted from issue #10041 on February 03, 2023 21:53.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
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
Uh oh!
There was an error while loading. Please reload this page.
-
What version of React Router are you using?
6.8
Steps to Reproduce
So, my setup is like this:
And user routes is like so:
And I have a protected route which is like so:
Protected route supposed to get isLoggedIn from redux slice
Now, the thing is, when I initially logged in and try to logout, it works fine. Protected route gets state update from redux slice and navigates user to redirectPath.
But when I click any react router link and try to logout after that, protected route does not rerender. It just stays on the same page, despite the fact that state got updated. I have to explicitly reload the page for it to work.
Also, when I do not split routes into multiple files and keep everything in one file, everything functions well.
Anyone has idea why it works like this?
Expected Behavior
Proctected route has to rerender and get update from redux.
Actual Behavior
Protected route does not rerender, but redux state is updated. It sees update only after refreshing page
Beta Was this translation helpful? Give feedback.
All reactions