Closed ferretwithaberet closed 5 months ago
React router loaders run twice when using React.StrictMode
React.StrictMode
1.18.5
https://stackblitz.com/edit/vitejs-vite-jbnrwj?file=src%2Fmain.tsx&terminal=dev
Loader
console.log
Routes
The loader should only run once
No response
Might be related to https://github.com/remix-run/react-router/discussions/10605
Hey @ferretwithaberet, thanks for opening this issue and providing the related issue. I just released v1.18.7 with the fix.
Describe the Bug
React router loaders run twice when using
React.StrictMode
Generouted Version
1.18.5
Your Example Website or App or Reproduction
https://stackblitz.com/edit/vitejs-vite-jbnrwj?file=src%2Fmain.tsx&terminal=dev
Steps to Reproduce the Bug or Issue
Loader
;console.log
inside theLoader
;React.StrictMode
above theRoutes
component;Loader
runs twice.Expected Behavior
The loader should only run once
Screenshots or Videos
No response
Platform
Additional context
Might be related to https://github.com/remix-run/react-router/discussions/10605