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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMR does not work unless component has an active instance #4757

Closed
ElMassimo opened this issue Oct 7, 2021 · 3 comments
Closed

HMR does not work unless component has an active instance #4757

ElMassimo opened this issue Oct 7, 2021 · 3 comments

Comments

@ElMassimo
Copy link

ElMassimo commented Oct 7, 2021

Version

3.2.19

Reproduction link

github.com

Steps to reproduce

Reproduction steps in ElMassimo/vite-vue-router-hmr-repro

What is expected?

HMR should work for any components that have been imported in the current page.

What is actually happening?

A regression was introduced in 3.2.11. 3.2.10 behaves as expected.

HMR only works if the component has an active instance.


Most users experience this issue when using vue-router, as no full reload occurs, and is not unusual to navigate between pages.

It can happen in different scenarios, for example, a component that is conditionally displayed. If the user modifies the component file when the condition is false, and then the condition becomes true, the rendered component is outdated and won't reflect current changes until a page reload or another HMR update is sent.

@ElMassimo
Copy link
Author

Since plugin-vue is still providing _sfc_main as a second parameter to the HMR createRecord function, it's likely that only changes to vue-next are needed.

@ElMassimo
Copy link
Author

ElMassimo commented Oct 7, 2021

@yyx990803 Confirmed that this is a regression, it was working in 3.2.10.

@ElMassimo
Copy link
Author

Works like a charm in 3.2.20, thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants