Skip to content

fix(types): prevent shallowReactive marker from leaking into value unions#14493

Merged
edison1105 merged 3 commits intomainfrom
edison/fix/14490
Mar 25, 2026
Merged

fix(types): prevent shallowReactive marker from leaking into value unions#14493
edison1105 merged 3 commits intomainfrom
edison/fix/14490

Conversation

@edison1105
Copy link
Copy Markdown
Member

@edison1105 edison1105 commented Feb 28, 2026

close #14490

Summary by CodeRabbit

  • Bug Fixes
    • Fixed shallow-reactive type behavior to prevent marker propagation into union types, improving type compatibility for shallow reactive values.
  • Tests
    • Added a test that verifies the shallow-reactive marker does not leak into union-typed values.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9e3288a-1a02-4216-8274-c2eacb2a74a6

📥 Commits

Reviewing files that changed from the base of the PR and between 59d53ec and 1f76692.

📒 Files selected for processing (1)
  • packages/reactivity/src/ref.ts

📝 Walkthrough

Walkthrough

Change ShallowReactive's marker type from an optional boolean to a required never and adjust UnwrapRefSimple's object-branching to prevent the shallow-reactive marker from leaking into union/value unwrapping; added a dts test asserting the marker no longer appears in unions.

Changes

Cohort / File(s) Summary
ShallowReactive type
packages/reactivity/src/reactive.ts
Changed ShallowReactive<T> marker from [ShallowReactiveMarker]?: true to [ShallowReactiveMarker]: never.
Unwrap/ref logic
packages/reactivity/src/ref.ts
Updated UnwrapRefSimple<T> branching: objects with required ShallowReactiveMarker now short-circuit to T, while other objects follow the previous property-unwrapping mapping.
Tests (dts)
packages-private/dts-test/reactivity.test-d.ts
Added test "shallowReactive marker should not leak into value unions" and imported shallowReactive to verify the marker is not present in derived union types.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ready to merge, scope: reactivity, :cake: p2-nice-to-have

Poem

🐰 I nudged a tiny marker into "never" land,
So unions breathe easy and types now stand.
No more stray true in the type parade,
Shallow paths stay shallow — a carrot parade! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: preventing the shallowReactive marker from leaking into value unions, which is the core objective of the PR.
Linked Issues check ✅ Passed The PR implements the required type changes to prevent ShallowReactiveMarker from leaking into value unions used by v-for, addressing all objectives from issue #14490.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the type inference issue: ShallowReactive marker type redefinition, UnwrapRefSimple logic adjustment, and a corresponding test case.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch edison/fix/14490

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 28, 2026

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 105 kB 39.8 kB 35.8 kB
vue.global.prod.js 164 kB 59.8 kB 53.2 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.3 kB 18.8 kB 17.2 kB
createApp 56.5 kB 21.8 kB 19.9 kB
createSSRApp 60.7 kB 23.6 kB 21.5 kB
defineCustomElement 62.6 kB 23.8 kB 21.7 kB
overall 71 kB 27.2 kB 24.8 kB

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 28, 2026

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 1f76692

@edison1105 edison1105 changed the title fix(types): exclude symbol keys from renderList object value inference fix(types): prevent shallowReactive marker from leaking into value unions Feb 28, 2026
@edison1105
Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@vuejs vuejs deleted a comment from edison1105 Mar 25, 2026
@vuejs vuejs deleted a comment from edison1105 Mar 25, 2026
@vue-bot
Copy link
Copy Markdown
Contributor

vue-bot commented Mar 25, 2026

📝 Ran ecosystem CI: Open

suite result latest scheduled
primevue success success
language-tools failure failure
pinia success success
quasar failure failure
vitepress success success
vant success success
vueuse success success
vue-macros success success
router success success
vuetify success success
radix-vue success success
vite-plugin-vue success success
test-utils success success
nuxt success success
vue-i18n success success
vue-simple-compiler success success

@edison1105 edison1105 merged commit 3b561db into main Mar 25, 2026
15 of 16 checks passed
@edison1105 edison1105 deleted the edison/fix/14490 branch March 25, 2026 09:06
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
edison1105 added a commit that referenced this pull request Mar 27, 2026
fix shallowReactive type regressions introduced by #14493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shallowReactive with v-for incorrect typing: property does not exist on type true

2 participants