-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
fix(react): conditionally self-accept fast-refresh HMR #10239
fix(react): conditionally self-accept fast-refresh HMR #10239
Conversation
I pushed a commit here that implements the Todo
|
a94c657
to
37dbbd0
Compare
56f52e1
to
5d6b80e
Compare
But this is broken because Vite still treats this as self-accepting.
5d6b80e
to
535aa4f
Compare
@aleclarson I've rebased this onto main now that the |
Moving the CTW Context and provider into separate files to avoid issues when changing certain files it errors out and says context is not defined. This is caused by a bug in vite which there is a current open pr on.. vitejs/vite#10239, which should solve this. Being that this bug is annoying enough in dev i am splitting context and provider into separate files to avoid this bug.
Moving the CTW Context and provider into separate files to avoid issues when changing certain files it errors out and says context is not defined. This is caused by a bug in vite which there is a current open pr on.. vitejs/vite#10239, which should solve this. Being that this bug is annoying enough in dev i am splitting context and provider into separate files to avoid this bug.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @zus-health/[email protected] ### Minor Changes - 1086140: Condition History Panel now has a stacked UI list detailing previous occurrences of different conditions. There is a preview summary card followed by a detailed card for each of the different conditions that have been recorded. - fb5fd96: When user edits or adds a condition, practitioner id will now be used to set the recorder field automatically. If no practitioner id is found then recorder will be nulled else the current practitioner id for the user will be used. ### Patch Changes - 112d3df: Move ctw provider and context into separate files to avoid bug outlined in <vitejs/vite#10239> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Thanks for the great job ! I think this was a blocking issue for a lot of us React users. There is a small issue with the CHANGELOG as this PR is not referenced there (even if it's int he commit history of release: v3.2.0-beta.1). |
Hi @abouroubi, this change was made to |
Description
Fixes #9869
Fixes #3301
Fixes #4298
Fixes #6885
Fixes #7396
Based on top of #10244
This makes a change to the HMR code that's injected by plugin-react to check the exports of a module, and determine whether it is safe to treat as a fast-refresh boundary. If it is a safe fast-refresh boundary, we will perform fast-refresh. If not, we now call
hot.invalidate()
(relying on the changes in #10244) to propagate HMR up to parents. This is necessary because vite seesimport.meta.hot.accept()
even if it's inside a conditional, and treats the module as self-accepting. So without callinghot.invalidate()
, the parent will never know to fast-refresh.I've also added a test here for changing a react context file, and verified that it fails without the changes here, but passes with them.
Additional context
The other PR, #10244 should be reviewed first, since this one depends on it.
Thanks for help on this, @aleclarson!
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes vitejs/vite#123
).