Skip to content

The el.__vnode is equal to the last el.__vnode after hmr(setupRenderEffect update), but el.__vueParentComponent.subTree is not equal to the last #5088

@FoxDaxian

Description

@FoxDaxian

Version

3.2.24

Reproduction link

replit.com

Steps to reproduce

<template>
  <div @click="log">after</div>
 // and then modify as below
 // <div @click="log">after</div>
</template>

<script setup>
let lastVnode;
let lastChildren;

function log (e) {
    const el = e.target;
    if (lastVnode) {
        console.log(lastVnode === el.__vnode, '__vnode');
        console.log(lastChildren === el.__vueParentComponent.subTree.children, 'children');
    }
    lastVnode = el.__vnode;
    lastChildren = el.__vueParentComponent.subTree.children;
}
</script>

<style>
</style>

What is expected?

before:

true '__vnode'

true 'children'

after:

false '__vnode'. <- this line

false 'children'

What is actually happening?

before:

true '__vnode'

true 'children'

after:

true '__vnode' <- this line

false 'children'


I'm making dev tool, this tool need find index of the child vnode in the parent vnode.
it is works when first render. but after hmr it is not work. since subTree changed but el.__vnode is not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions