Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial accept #58

Merged
merged 13 commits into from Sep 16, 2022
Merged

Partial accept #58

merged 13 commits into from Sep 16, 2022

Conversation

rixo
Copy link
Collaborator

@rixo rixo commented Sep 15, 2022

Implement Vite's partial accept, to fix HMR glitches with components that use context:module (see sveltejs/vite-plugin-svelte#134, for example).

Notice that there is really only one change, in packages/svelte-hmr/lib/make-hot.js. I should probably not have updated/added the demo apps in the same PR 馃槄 And then, there's the required configuration in playground/vite-app/vite.config.js.

To appreciate the effect, edit ModuleContext.svelte in the Vite app, with or without the partial accept config, and observe the difference in Vite's HMR logs. With partial accept, ModuleContext.svelte and CmpUsingContext.svelte get updated (but not CmpUsingOnlyDefault.svelte) and the change of the export from module:context is correctly reflected. Without partial accept, only ModuleContext.svelte gets updated (because it eats the HMR bubble), and changing the value of y isn't reflected correctly.

@dominikg
Copy link
Member

Should we enable this by default in v-p-s?

@rixo
Copy link
Collaborator Author

rixo commented Sep 16, 2022

Should we enable this by default in v-p-s?

Yes, I think so. This is arguably a bug fix.

@rixo rixo mentioned this pull request Sep 16, 2022
@rixo rixo merged commit 88a4efe into sveltejs:master Sep 16, 2022
@github-actions github-actions bot mentioned this pull request Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants