Replies: 2 comments 3 replies
-
|
All loaders run at the time their bundles are loaded => So this is the expected behavior.
Put the loadUser to the first line of the loader, then you will need some caching request feature - similar tanstack/query ensureQueryData - |
Beta Was this translation helpful? Give feedback.
-
|
This is a paper cut i face every day; sometimes many of my endpoints will call my API and if the session is expired only one of them will work and the others will return a Unauthorized error. Middleware will help solve this issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🚀 Issue: React Router v7 -
clientLoader()Runs BeforeloadUser()❓ Problem
I recently migrated my project to React Router v7 following the official upgrade guide:
🔗 React Router v7 Upgrade Guide.
Here are my main components:
root.tsxapp.tsxhome.tsx🔍 Expected Behavior
🛑 Actual Behavior
❓ Question
How can I ensure that loadUser() runs first before executing clientLoader()?
Would love any suggestions or best practices on handling this issue in React Router v7. 🚀
Tags:
React Router,Suspense,Middleware,Authentication,ReactBeta Was this translation helpful? Give feedback.
All reactions