Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loaders are executed twice when using React.StrictMode #159

Closed
ferretwithaberet opened this issue Mar 29, 2024 · 1 comment
Closed

Loaders are executed twice when using React.StrictMode #159

ferretwithaberet opened this issue Mar 29, 2024 · 1 comment

Comments

@ferretwithaberet
Copy link

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

  1. Make a router with a route that has a Loader;
  2. Add a console.log inside the Loader;
  3. Add React.StrictMode above the Routes component;
  4. Open browser console, navigate to the route and observe the Loader runs twice.

Expected Behavior

The loader should only run once

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux] Linux
  • Browser: [e.g. Chrome, Safari, Firefox] Firefox Developer Edition
  • Browser version: [e.g. 91.1] 125.0b5 (64-bit)

Additional context

Might be related to remix-run/react-router#10605

@oedotme
Copy link
Owner

oedotme commented Apr 7, 2024

Hey @ferretwithaberet, thanks for opening this issue and providing the related issue. I just released v1.18.7 with the fix.

@oedotme oedotme closed this as completed Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants