Skip to content

fix(runtime-vapor): remove leaving elements with the fragment that holds them - #16386

Open
jrandolf wants to merge 1 commit into
vuejs:minorfrom
jrandolf:fix/vapor-transition-unmount-leave
Open

jrandolf wants to merge 1 commit into
vuejs:minorfrom
jrandolf:fix/vapor-transition-unmount-leave

Conversation

@jrandolf

@jrandolf jrandolf commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #15923.

vdom removes a Fragment as the DOM range between its anchors (removeFragment in renderer.ts). A slot outlet, a v-for list, several roots and a <TransitionGroup> without a tag are such Fragments. An element that still leaves in a <Transition> or a <TransitionGroup> in the range goes with it. Vapor removes a fragment by its blocks, so the element stays until its leave ends. In 3.6.0-rc.16, a Vapor app keeps the leaving element after app.unmount() or after a v-if removes the range. A vdom app removes it at once.

<!-- Portal.vue -->
<Teleport to="body"><slot /></Teleport>

<!-- App.vue -->
<Portal>
  <Transition name="fade">
    <div v-if="show">leaving</div>
  </Transition>
</Portal>

Set show to false, then call app.unmount() while the <div> leaves. A vdom app removes the <div> from <body>. A Vapor app keeps it until its leave ends. Playground

With no Fragment around the Transition (a Transition root, a Transition in a Teleport), vdom also keeps the element until its leave ends, as #15923 tests. Vapor does the same there, and this change keeps it.

Fix. remove() marks a range while it removes a slot outlet, a v-for list or more than one block. A Transition that this removal reaches removes its leaving elements from the same parent. A <TransitionGroup> without a tag does so on each removal, because it is a Fragment itself. The leaves run to their end, so onAfterLeave comes at the end of the leave, as in vdom. A Teleport removes its children one by one and not as a range, as vdom's TeleportImpl.remove does. A range around a Teleport does not reach its target. A vdom Transition in a vdom component in a Vapor range still keeps its element, because runtime-core gives no access to its leaving elements.

Test. Vdom and Vapor give the same log when a v-if or app.unmount() removes the range while the child leaves, in each Transition mode: a Transition in a slot outlet, in a slot outlet in a Teleport, in a v-for list and beside another root; a <TransitionGroup> without a tag, alone and in a slot outlet. Two controls keep the element in both: a Teleport with several children, and a Teleport in a slot outlet.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 50505daa-deb2-485f-8a79-26c296dfa782

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@pkg-pr-new

pkg-pr-new Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@16386
npm i https://pkg.pr.new/@vue/compiler-core@16386
yarn add https://pkg.pr.new/@vue/compiler-core@16386.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@16386
npm i https://pkg.pr.new/@vue/compiler-dom@16386
yarn add https://pkg.pr.new/@vue/compiler-dom@16386.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@16386
npm i https://pkg.pr.new/@vue/compiler-sfc@16386
yarn add https://pkg.pr.new/@vue/compiler-sfc@16386.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@16386
npm i https://pkg.pr.new/@vue/compiler-ssr@16386
yarn add https://pkg.pr.new/@vue/compiler-ssr@16386.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@16386
npm i https://pkg.pr.new/@vue/compiler-vapor@16386
yarn add https://pkg.pr.new/@vue/compiler-vapor@16386.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@16386
npm i https://pkg.pr.new/@vue/reactivity@16386
yarn add https://pkg.pr.new/@vue/reactivity@16386.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@16386
npm i https://pkg.pr.new/@vue/runtime-core@16386
yarn add https://pkg.pr.new/@vue/runtime-core@16386.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@16386
npm i https://pkg.pr.new/@vue/runtime-dom@16386
yarn add https://pkg.pr.new/@vue/runtime-dom@16386.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@16386
npm i https://pkg.pr.new/@vue/runtime-vapor@16386
yarn add https://pkg.pr.new/@vue/runtime-vapor@16386.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@16386
npm i https://pkg.pr.new/@vue/server-renderer@16386
yarn add https://pkg.pr.new/@vue/server-renderer@16386.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@16386
npm i https://pkg.pr.new/@vue/shared@16386
yarn add https://pkg.pr.new/@vue/shared@16386.tgz

vue

pnpm add https://pkg.pr.new/vue@16386
npm i https://pkg.pr.new/vue@16386
yarn add https://pkg.pr.new/vue@16386.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@16386
npm i https://pkg.pr.new/@vue/compat@16386
yarn add https://pkg.pr.new/@vue/compat@16386.tgz

commit: e59d83f

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.5 kB 30.7 kB 26.9 kB
runtime-dom.global.prod.js 125 kB 47 kB 42 kB
vue.global.prod.js 186 kB 67.2 kB 59.8 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 55.7 kB 21.7 kB 19.8 kB
createApp 65 kB 25.1 kB 22.8 kB
createApp + vaporInteropPlugin 126 kB (+87 B) 46.1 kB (+33 B) 41.4 kB (+6 B)
createVaporApp 36.2 kB (+126 B) 13.9 kB (+40 B) 12.8 kB (+37 B)
createSSRApp 69.9 kB 27.1 kB 24.6 kB
createVaporSSRApp 44.5 kB (+126 B) 17 kB (+41 B) 15.6 kB (+11 B)
defineCustomElement 71.5 kB 27.1 kB 24.5 kB
defineVaporCustomElement 51.3 kB (+126 B) 18.7 kB (+32 B) 17.2 kB (+23 B)
overall 82.2 kB 31.1 kB 28.1 kB

…lds them

vdom removes a Fragment (a slot outlet, a v-for list, several roots, a
TransitionGroup without a tag) as the DOM range between its anchors. An
element that still leaves in a Transition or a TransitionGroup in that
range goes with it. Vapor removes blocks, so the element stayed until
its leave ended. A Vapor app then kept a leaving element after
`app.unmount()` where a vdom app removed it.

Removal of a slot outlet, a v-for list or several blocks now marks a
range. A Transition removed in a range removes its leaving elements from
the same parent. A TransitionGroup without a tag does so on each
removal. The leave runs to its end, as in vdom. A Teleport's children
are not a range, as in vdom.
@jrandolf
jrandolf force-pushed the fix/vapor-transition-unmount-leave branch from 165062d to e59d83f Compare November 23, 2026 03:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant