Skip to content

fix(reactivity): release computeds read outside of their scope on stop - #16429

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/reactivity-release-scoped-computed
Nov 26, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/reactivity-release-scoped-computed

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

close #16390

A computed created in setup() and read only outside of effects, e.g. in an event handler, stays subscribed to what it reads, so a long-lived store keeps it, and through its getter the unmounted component, alive.

Nothing owned such a read. I made a computed remember the scope it was created in: a read outside of any scope counts as a read there unless something already keeps the computed, so unmount releases it. This replaces the SSR-only link from #16013. A stopped scope now drops its cleanups, so the computed's reference to it stays cheap.

Once that scope has stopped, every read without a subscriber recomputes, as reads in a stopped scope do since #16114. The extra field costs a few ns per computed() and 16 B gzip.

@coderabbitai

coderabbitai Bot commented Nov 24, 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: f95c6c6b-769e-4366-b9dd-869b8b66c7d7

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 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 650e4bb

@github-actions

github-actions Bot commented Nov 24, 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 126 kB (+7 B) 47.3 kB (+6 B) 42.3 kB (-32 B)
vue.global.prod.js 187 kB (+9 B) 67.6 kB (+5 B) 60.1 kB (-39 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 55.8 kB (+21 B) 21.7 kB (+2 B) 19.8 kB (+29 B)
createApp 65 kB (+11 B) 25.1 kB (+2 B) 22.8 kB (+11 B)
createApp + vaporInteropPlugin 126 kB (+11 B) 46.2 kB (+2 B) 41.5 kB (+27 B)
createVaporApp 36.4 kB (+21 B) 13.9 kB (+3 B) 12.8 kB (+4 B)
createSSRApp 70 kB (+11 B) 27.1 kB 24.6 kB (+2 B)
createVaporSSRApp 45.1 kB (+21 B) 17.1 kB (+2 B) 15.7 kB (+2 B)
defineCustomElement 71.6 kB (+11 B) 27.1 kB (+5 B) 24.6 kB (+4 B)
defineVaporCustomElement 51.5 kB (+21 B) 18.8 kB (+3 B) 17.2 kB (+10 B)
overall 82.2 kB (+9 B) 31.1 kB (+5 B) 28.1 kB (-17 B)

Apps

Name Size Gzip Brotli
counter app (CAPI only) 57.4 kB (+21 B) 22.3 kB (+3 B) 20.3 kB (-27 B)
counter vapor app (CAPI only) 46.7 kB (+21 B) 17.4 kB (+2 B) 16 kB (+6 B)
todo app (CAPI only) 73.4 kB (+11 B) 28.2 kB (+3 B) 25.7 kB (+44 B)
todo vapor app (CAPI only) 79.8 kB (+12 B) 29.5 kB (+8 B) 26.8 kB (+10 B)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants