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
However, this code has a few drawbacks. I want to check if the user is authenticated only once, and then to be able to read the cached version. But root file is called before every other route is executed, so each time I navigate the page the call will fire.
Even if I change fetchQuery to ensureQueryData nothing will change, because that query is in inactive state.
I tried to move logic out of beforeLoad function, api call fires only once, becomes stale, but then my redirects after logout or to dashboard stopped working.
So my problem is that I'm doing too much requests, because of the root functionality.
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I've got this fully working example:
However, this code has a few drawbacks. I want to check if the user is authenticated only once, and then to be able to read the cached version. But root file is called before every other route is executed, so each time I navigate the page the call will fire.
Even if I change
fetchQuery
toensureQueryData
nothing will change, because that query is in inactive state.I tried to move logic out of beforeLoad function, api call fires only once, becomes stale, but then my redirects after logout or to dashboard stopped working.
So my problem is that I'm doing too much requests, because of the root functionality.
Maybe I should consider other way of thinking ?
Beta Was this translation helpful? Give feedback.
All reactions