Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reactivity): trigger the ref that is created by toRef from a reactive array #12431

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

noootwo
Copy link
Contributor

@noootwo noootwo commented Nov 18, 2024

fix #12427

Copy link

pkg-pr-new bot commented Nov 18, 2024

Open in Stackblitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@12431

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@12431

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@12431

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@12431

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@12431

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@12431

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@12431

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@12431

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@12431

vue

pnpm add https://pkg.pr.new/vue@12431

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@12431

commit: eccd16e

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+43 B) 38 kB (+20 B) 34.2 kB (-26 B)
vue.global.prod.js 158 kB (+43 B) 57.8 kB (+21 B) 51.4 kB (-4 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47.2 kB 18.3 kB 16.8 kB
createApp 55.2 kB 21.3 kB 19.5 kB
createSSRApp 59.3 kB 23.1 kB 21 kB
defineCustomElement 60.1 kB 22.9 kB 20.8 kB
overall 69.1 kB 26.5 kB 24.1 kB

@edison1105 edison1105 added scope: reactivity 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Nov 18, 2024
@edison1105
Copy link
Member

According to the reproduction in #12427, the issue likely lies within toRef. If source is an array and the key is a number, the key should be converted to a string. However, modifying getDepFromRective broadens the impact scope.
Additionally, getDepFromReactive is not a public API, and the test case should ideally use public APIs.

@noootwo
Copy link
Contributor Author

noootwo commented Nov 19, 2024

According to the reproduction in #12427, the issue likely lies within toRef. If source is an array and the key is a number, the key should be converted to a string. However, modifying getDepFromRective broadens the impact scope. Additionally, getDepFromReactive is not a public API, and the test case should ideally use public APIs.

But for getDepFromReactive, it should indeed exhibit such behavior, as it needs to handle this case for all reactive arrays.

@edison1105 edison1105 changed the title fix(reactivity): triggerRef fails when target is an array fix(reactivity): trigger the ref that is created by toRef from a reactive array Nov 19, 2024
@edison1105 edison1105 added ready to merge The PR is ready to be merged. and removed wait changes labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: reactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

triggerRef fails when target is an array
3 participants