Skip to content

[Teleport] Cannot find the target node when teleport nested and set conditional rendering #13771

@libondev

Description

@libondev

Vue version

3.5.18

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-ifzgrlqm?file=src%2FTTeleport.vue&terminal=dev

Steps to reproduce

  1. Open the browser console.
  2. Delete/restore v-if="isVue3" and wait for hot update.

What is expected?

Correctly handle mounting nodes inside components

What is actually happening?

The target element cannot be found when processing the mount node.
TypeError: Cannot read properties of null (reading 'nextSibling')
at nextSibling (vue.js?v=f5f5a4e4:10626:31)
at removeFragment (vue.js?v=f5f5a4e4:8075:14)
at remove2 (vue.js?v=f5f5a4e4:8046:9)
at unmount (vue.js?v=f5f5a4e4:8024:9)
at Object.remove (vue.js?v=f5f5a4e4:3087:9)
at unmount (vue.js?v=f5f5a4e4:7999:20)
at patch (vue.js?v=f5f5a4e4:6789:7)
at ReactiveEffect.componentUpdateFn [as fn] (vue.js?v=f5f5a4e4:7550:9)
at ReactiveEffect.run (vue.js?v=f5f5a4e4:495:19)
at vue.js?v=f5f5a4e4:2586:14

System Info

Although this seems to have nothing to do with the system environment, I will still attach my device information.


  System:
    OS: macOS 15.5
    CPU: (8) arm64 Apple M1
    Memory: 1.20 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.1.0 - /usr/local/bin/node
    npm: 9.6.3 - /opt/homebrew/bin/npm
    pnpm: 10.13.1 - /opt/homebrew/bin/pnpm
    bun: 1.1.2 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 139.1.81.131
    Chrome: 139.0.7258.67
    Safari: 18.5

Any additional comments?

Image

I am currently implementing a component library compatible with both vue2 and vue3, but since there is no built-in teleport component in vue2, this judgment processing is necessary in the template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: hmr

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions