I have an issue with react/redux and authentication - the authentication part works well, I can log in and log out. The problem occurs when I log out with one user and log in with another - it occasionally displays the data of the previously logged in user.
I am using react and redux. I can see the data in redux is cleared on log out, all user or user profile information is removed. The token is also correctly removed from local storage. When I log in with a different user, I can see in the redux devtools that the correct data is fetched, however, the data displayed on screen is different and is the data from the user previously logged in.
If I refresh the page the correct information is then displayed.
My question is, where else is that data stored? is there a cache somewhere that I need to clear?
My reducer looks like this:
case LOGOUT:
localStorage.removeItem('token');
return{
...state,
user: null,
token: null,
isAuthenticated: false,
loading: false
};
I can see all gets cleared out as expected.. I'm not sure where the data comes from?