core icon indicating copy to clipboard operation
core copied to clipboard

Bug in the invocation order of lifecycle hooks during component remounting/unmounting controlled via key

Open Huangxianli opened this issue 6 months ago • 1 comments

Vue version

3.5.14

Link to minimal reproduction

https://play.vuejs.org/#eNp9U01v2zAM/SuELrGBwD5sp8wJtg49bEO3YR83XVybcdzIkiHJaYrA/72U5Kh1keZkiu898VGkT+xL32eHAdmKFabSbW/BoB36DZdt1ytt4avqethq1cEiy93B0RefIn4CjVsYJ8qEcVkpaSzoUtaq+4FPsHa05K60uywkkzQlYqBVu1I2GGhJCusNnLiEF3V2KMWAa5jJST26SkUejJNlOljselFapBNA4c2v9vi05izexhnkAb4frFUSPleirfZEiT4424QYSGuKPBBJVOSvCrAls4Y62LZN9mCUpEf0vukiqtsK1L9621KHnK1CRw4rhVCP333O6gGX53y1w2p/If9gji7H2W+NBvUBOYuYLXWDNsC3f3/ikeIIdqoeBLGvgH/QKDE4j4F2M8iabL/iebff/Khb2fwzt0eL0pybckYdc/R8zmj87snfa/3F7ofso9fRDOkVz2v1/haeQMkb3CqNd2qQdqmk/2JNUcj/l92ETBHWb7dydkWSpG7P3AIqgZlQTbKYERbp6HYsVrosmMBInpm5VmOiRGF0fVkU4Ulwbevr9uAD8D+vT+UhN1/f8RlJ5F6x

Steps to reproduce

1.Open the browser console 2.Click button 3.Check the console output

What is expected?

The output order is: onBeforeUnmount -> onUnmounted -> onBeforeMount -> onMounted

What is actually happening?

The output order is: onBeforeUnmount -> onBeforeMount -> onUnmounted -> onMounted

System Info


Any additional comments?

No response

Huangxianli avatar May 15 '25 12:05 Huangxianli