Skip to content

[bug] Lifecycle hooks has been called twice in HMR when I use "v-for + ref" and "script setup" in RouterView. #7908

Closed as not planned
@lifetimesw

Description

@lifetimesw

Vue version

3.2.45

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-fx7e3m?file=src/views/HelloWorld.vue

Steps to reproduce

  • Create a vue3 repo with vue-router
  • Use Composition Api in the components of RouterView
  • Use v-for + ref attribute on the html element
  • Define a proxy object to the ref attribute
  • Change and save the content in <script setup> to trigger hot module replacement

What is expected?

onMounted will be Called once

What is actually happening?

onMounted will be Called twice.

System Info

"mounted" will be print twice on the browser console

Any additional comments?

动画
1679047586712

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions