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死循环渲染 #144

Open
7 tasks done
npmrun opened this issue Apr 3, 2023 · 2 comments
Open
7 tasks done

hmr死循环渲染 #144

npmrun opened this issue Apr 3, 2023 · 2 comments

Comments

@npmrun
Copy link

npmrun commented Apr 3, 2023

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

@stackblitz
Copy link

stackblitz bot commented Apr 3, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red transferred this issue from vitejs/vite Apr 3, 2023
@edison1105 edison1105 added p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) and removed pending triage labels Sep 24, 2024
@edison1105
Copy link
Member

使用如下版本,将不再触发死循环,只会多一条数据。

  "dependencies": {
    "vue": "3.5.10"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "5.1.4",
    "vite": "5.4.8",
  }

@edison1105 edison1105 removed the p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants