vite-plugin-vue
vite-plugin-vue copied to clipboard
hmr死循环渲染
Describe the bug
父组件注入响应式数据到子组件,子组件修改响应式数据,父组件展示此响应式数据,子组件修改时触发渲染,由于slot中存在子组件,造成子组件又渲染,子组件又修改了响应式数据,使得死循环。不知道算不算问题,不算的话直接关掉了
Reproduction
https://stackblitz.com/edit/vitejs-vite-tu3tor?file=src%2FComp.vue,src%2FComp1.vue&terminal=dev
Steps to reproduce
开发模式下修改Comp1.vue的all.value.push("1")的push值即可,可以看到多了很多一样的数据
修改可以把Comp.vue的{{all}}注释掉
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@vitejs/plugin-vue: ^4.1.0 => 4.1.0
vite: ^4.2.1 => 4.2.1
Used Package Manager
npm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
使用如下版本,将不再触发死循环,只会多一条数据。
"dependencies": {
"vue": "3.5.10"
},
"devDependencies": {
"@vitejs/plugin-vue": "5.1.4",
"vite": "5.4.8",
}