-
Notifications
You must be signed in to change notification settings - Fork 194
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
Error on HMR reload #177
Comments
This would need a minimal reproducing example. Could be a webpack bug. |
Other than a Webpack bug, this might be due to no available boundaries within the whole chain (i.e. no files in that chain contains only React components a-la |
@pmmmwh do you know where could I read more about this issue to understand it better? Also. Do you have any idea why it doesn't reload the whole page instead if it fails to update? Because after the before mentioned error the page stops reloading. |
I don't have a definitive source for you, but React Refresh relies on exports' names to detect whether it is something we can accept (so does other dev tooling such as the hooks eslint plugin). So if a path of update propagation does not include anything we can accept, we unfortunately have to bail out.
It seems like Webpack's hot reloading crashed. I can help take a look at the actual config if you can provide it (with versions of webpack and react/react-dom used). |
I will close this issue for now. If I will manage to recreate a public example of the issue I will reopen the issue. Thanks for the help. |
fwiw, I had something similar with webpack The browser's log with
Edit: I was somehow wrong, I also get the error with 4.43 :/ and the error differs slighlty:
|
I think it is quite contextual? It says that |
You mean "meaningful" or "clear" (...what the problem is)?
Would you mind to elaborate? Why does the Edit: I've read in one of your other comments A valid refresh boundary is usually a file that contains only React-related exports (function components needs to be UpperCamelCase to be correctly detected) because there's no way we can guarantee that non-React exports are PURE in nature and side-effects free (thus auto-update-able). Since there's no file that conforms to the requirements for React-refresh to set up refresh boundaries on your update propagation path, we're forced to bail out and not apply the update. So that means that at some point it's expected that your HMR bails out if no valid React component is found, right?! So everything is ok and this "error" you display is more kind of an information?! Edit2:
I find this still confusing, so what is your suggested way to structure an app? In any case if this error is just a warning or info, it should be changed, otherwise users get confused. |
(Sorry for missing this)
Yes.
How
Yes. Let's say your component tree is like this: If Component A is changed and we can update it, fine we won't propagate the update (only Component A updates). But if the update from Component A defies what we require for a safe update, we would have to go to its parent. However, it's parent is also unsafe to update in place - so eventually we bubbled to "root" which means to the actual entry point of the JS - so the only way we can guarantee consistency is to bail out (in browsers this equals a full refresh). That is also not something we print - it is what
Refering to the case I've described above - the best way to avoid unnecessary bail outs when you edit code paths that is very close to root (i.e. ReactDOM.render) is to not have any JSX at all in the file you do ReactDOM.render. This is because we only construct boundaries with exports, and the file containing ReactDOM.render would most likely not have any exports, thus will never have a boundary. |
in case you haven't tried, restarting the computer did it for me |
I was able to solve the issue wrapping the app into a component
Then add the browser router
|
In my case, it was caused by additional export next to component export:
|
Thanks, I was going crazy with this and it was just that the moment there was a single export it worked! |
@alvaro-escalante I, fortunately, succeeded on the first try since I didn't have any extra export. Now I'm curious why having more than one export will force it to full-reload. On the other hand, it seems that the author of this plugin suggests that we should not use |
You are my jesus. I love you so much! |
I am trying to use fast refresh with WPS. With some components it works fine however with others, I get this error.
Plugin version
0.4.1
WPS:
1.0.1
Any pointers where could the issue lie?
The text was updated successfully, but these errors were encountered: