For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.
It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.
This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.
My question is
Is there another smarter way to detect session id invalidation from the client side?
Are there side effects I'm missing with the "page redirection" detection solution?