-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
HMR freezes browser when using react-router #116
Comments
The issue is that you creating a component with a lower case and then re-exporting as an upper case so that the plugin things everything is fine but Babel did not apply fast refresh to the wrapper. Change your code to |
Thanks @ArnaudBarre! Sorry about the misleading issue title. I had no idea that the root cause was my capitalization. |
Ok found the culprit. This is due to the shadow rename (I still think this is a bad practice because it can confuse grep search and humans too). It will be fixed in the next release (see latest commit on main). In the meantime you can apply the patch by changing line 19 of Edit: After investigation, this fix is safe. |
Thanks @ArnaudBarre! That patch works perfectly! My team will really appreciate this. |
Describe the bug
If I change the contents of a functional component that's wrapped in react-router's
withRouter()
, or if I change any of the children of that component, then HMR kicks in, but the browser hangs, eventually resulting in out-of-memory.This issue started happening in version 3.1.0. It also started happening in @vitejs/plugin-react-swc in the same version.
Others have encountered the same issue, but with a different router:
TanStack/router#532
TanStack/router#510
Reproduction
https://stackblitz.com/edit/vitejs-vite-jvmb7t?file=src/App.jsx
Steps to reproduce
Install the following dependencies:
Configure "@vitejs/plugin-react" in vite.config.js.
Wrap a functional component in
withRouter()
.Launch the dev server and change the contents of the functional component.
Browser will hang, eventually resulting in out-of-memory.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: