Subscribe on changes!

`<transition appear>` with both v-if and v-show calls the enter hooks twice

avatar
May 6th 2021

Version

3.0.11

Reproduction link

https://codepen.io/kaelwd/pen/poeomzz?editors=1011

Steps to reproduce

Click the button

What is expected?

"beforeEnter" should be logged once

What is actually happening?

"beforeEnter" is logged twice


This worked in Vue 2: https://codepen.io/kaelwd/pen/eYvYaYp?editors=1011

vShow explicitly calls transition.enter on mounted, there should probably be some sort of flag to make sure it hasn't already been called by appear https://github.com/vuejs/vue-next/blob/5ad4036e29f75dc907e95b99a63325b855332566/packages/runtime-dom/src/directives/vShow.ts#L17-L21

avatar
May 7th 2021

This is not a bug, you should use the persisted prop https://v3.vuejs.org/api/built-in-components.html#transition