Vue-next: `beforeUnmount` is called twice

Created on 19 Sep 2020  路  2Comments  路  Source: vuejs/vue-next

Version

3.0.0

Reproduction link

Reproduction 1
https://codesandbox.io/s/vue-unmount-bug-hdi3o?file=/src/index.js

Reproduction 2 (using template, has bug)
https://codesandbox.io/s/vue-unmount-bug-2-vr290?file=/src/index.js
Reproduction 2 (using h, behaves correctly, it could be a bug of vue compiler)
https://codesandbox.io/s/vue-unmount-bug-render-1bhk1?file=/src/index.js

Reproduction 2.1 (a more compact reproduction of R2)
https://codesandbox.io/s/vue-unmount-bug-21-8jo3l

R1 and R2 may be caused by different reasons, please have a look.

Steps to reproduce

follow the link.

What is expected?

beforeUnmount is called once.

What is actually happening?

beforeUnmount is called twice.


It seems different child of a parent instance resolve to the same child instance. The reproduction condition is quite wired.

update: maybe it's related to createBlock.

bug

Most helpful comment

Yes, they caused by different reasons, I have fixed it in the latest commit.

All 2 comments

Reproduction 2 is not fixed by https://github.com/vuejs/vue-next/pull/2173.

Yes, they caused by different reasons, I have fixed it in the latest commit.

Was this page helpful?
0 / 5 - 0 ratings