-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
When using SSR, HMR works in one place and then doesn't work elsewhere in the exact same component template!! #6567
Comments
Since this is something I'd really like to see some progress on, I've done a bit of my own digging into the source code to see if I can find some more information. Here's what I've found. Hopefully it is helpful. First a Brief ReviewThis app is using Vite's SSR functionality. HMR is working when the text inside of <template>
<div>
<div>WORKS</div>
<div> <!-- <<< We'll call this `div` "A" -->
<div>DOESN'T WORK</div> <!-- <<< We'll call this `div` "B" -->
</div>
</div>
</template> The comments will become useful in a moment below. When "DOESN'T WORK" is changed to (for example) "DOESN'T WORK ARGHHH", the following error is logged to the console:
InvestigationAs you can see in the message, this error is coming from const nodeOps = {
...
setElementText: (el, text) => {
el.textContent = text;
}
...
}; So the problem here is that for some reason when Vue tries to set the new Using a debugger I've been able to narrow things down to the Something about this logic must be wrong, because it results in the app having a tree where Call for HelpThis is where I'm lost. I don't know enough about how Vue works internally to say what exactly is wrong with the logic here. It seems to me that clearly |
Anyone willing to step in here and help figure out what's causing this issue? |
Closing as I confirmed that this was fixed with vuejs/core#5406. |
Describe the bug
When using SSR, HMR seems to be breaking in a extremely weird way. In a specific example component I've simplified down from an actual real-world component I'm building, I've found that in a certain part of the component I can make changes and HMR works perfectly, but in another part of the exact same component template, HMR doesn't work!
See the reproduction for the most concise example I could come up with. Instructions for reproducing the issue are in the README. Please be aware that while the repository is using the
vite-plugin-ssr
plugin to simplify SSR, I also was able to reproduce the issue in Vite's ownssr-vue
playground, so I know it is an underlying issue that doesn't have anything to do withvite-plugin-ssr
. The repo with thevite-plugin-ssr
plugin is much more minimal IMO, but if you're having issues with it, I can provide a reproduction without the plugin as well.Per the bug report form instructions, I've done my best to narrow down the bug to the point where I'm confident it's an issue with Vite. However, I acknowledge that I'm not familiar enough with the whole Vue ecosystem of packages to be 100% sure.
Reproduction
https://github.com/AaronBeaudoin/vite-vue-ssr-bug-repr
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: