-
Notifications
You must be signed in to change notification settings - Fork 10
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
decline() vs not accept() #10
Comments
So what I've learned since starting this: the trickiest part of HMR is event bubbling. If a file changes, an "update" event is kicked off that starts to bubble up your import graph. If the changed file itself has an accept handler, then great! That handler gets called, and the update is complete. If the changed file doesn't have an accept handler, then that update event bubbles up to all of changed files dependents. And so on up the import graph until every update event as been accepted, or one event has bubbled up past a root node (no imports) unhandled, in which case a full page reload is triggered.
|
Calling import.meta.hot.decline() clearly indicates that a change to the module should result in a full page reload.
What about a file that doesn't call any APIs on import.meta.hot?
Because HMR usually requires cooperation of the module to work, it seems like a module should by default behave as though it called
import.meta.hot.decline()
, so that changes to it result in a full page refresh.The text was updated successfully, but these errors were encountered: