beforeLoad passing context from zustand is not reactive
when I pass isAuth from zustand store reload page first it is false then it load the user and makes it true. but beforeLoad can't detect that state change it's only once? how can I overcome this using other ways?

3 Replies
other-emerald•2y ago
I have the same question! Unfortunately, I can determine if the user is signed in or not only on the browser - after the very first render. I have a boolean called
isInitialLoading which will be true until we figure out whether we have authenticated user or not. How to make beforeLoad reactive or is there any method to pause loading of the route? We are using Vite + React SPAmetropolitan-bronze•2y ago
is
beforeLoad executed again after isAuthenticiated changed from false to true ?quickest-silverOP•2y ago
I don't think so. maybe that's why it's not working
I thought it would react to the state change but nope