How to update context/session without refreshing the page?
I am using
I have this working properly on page load if the user is already logged in, and I have a hook that basically just forwards
My login flow is using a server function to validate login and set the session cookie.
Is it possible to force the useRouteContext hook to update when the user logs in, without refreshing the whole page? Similarly, on protected routes, for the
Or alternatively, is there another way I should be pulling down the session data?
createRootRouteWithContext for my __root route. Within that I am loading the user session in the beforeLoad functionI have this working properly on page load if the user is already logged in, and I have a hook that basically just forwards
RootRoute.useRouteContext().session to anywhere in the app that needs the user data. This also allows my pages to redirect or 404 on the server if the user hits a 'protected' pageMy login flow is using a server function to validate login and set the session cookie.
Is it possible to force the useRouteContext hook to update when the user logs in, without refreshing the whole page? Similarly, on protected routes, for the
beforeLoad to trigger again with the updated session?Or alternatively, is there another way I should be pulling down the session data?