Replies: 1 comment 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.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🚀 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.tsx
app.tsx
home.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
,React
Beta Was this translation helpful? Give feedback.
All reactions