-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 crashes page with React when saving Provider Component #9397
Comments
This is still broken. |
I'm seeing the same behavior on the same project as the OP, but 100% of the time. Assigning the values returned from Here's a branch running parcel and React 19 where you can reproduce: |
Never mind, I'm a dummy and messed up my imports. For reference, the broken There may still be issues from OP's report, but my problem is solved by the above. |
🐛 bug report
When I save a file in my project (even if it wasn't changed) that provides a Context and the respective Provider, HMR will try to hot-reload the page and crash it in the process.
The error message is
TypeError: _reactDefault.default.useContext(...) is undefined
.🎛 Configuration (.babelrc, package.json, cli command)
No babel, I just run
npm exec parcel public/index.html
🤔 Expected Behavior
I would expect the hot reload to work.
😯 Current Behavior
The page crashes with the following error:
💁 Possible Solution
If only I knew 🤷
🔦 Context
I wanted to create a Provider component to avoid prop drilling as part of an exercise.
💻 Code Sample
See https://github.com/iFreilicht/project-toast/tree/parcel-hmr-repro. To quote the README:
🌍 Your Environment
The text was updated successfully, but these errors were encountered: