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): avoid trigger effect in deleteProperty when array length-decrease mutation methods called #6037

Closed
wants to merge 5 commits into from

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented May 31, 2022

fix #6018
the root cause see: #6017 (comment)

@edison1105 edison1105 changed the title fix(reactivity): fix array length-decrease mutation methods work with JSON.stringify fix(reactivity): avoid trigger effect in deleteProperty when array length-decrease mutation methods called Sep 15, 2022
fix(reactivity): fix array splice work with JSON.stringify edge case

fix(reactivity): fix array length-decrease mutation methods work with JSON.stringify
@@ -203,7 +203,7 @@ function deleteProperty(target: object, key: string | symbol): boolean {
const hadKey = hasOwn(target, key)
const oldValue = (target as any)[key]
const result = Reflect.deleteProperty(target, key)
if (result && hadKey) {
if (result && hadKey && !isArray(target)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this also prevent reactivity from being triggered when using the delete operator with an array?

This seems to work fine on main:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issues were also fixed in #5912
see

Close this one.

@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB 32.6 kB 29.5 kB
vue.global.prod.js 132 kB 49.3 kB 44.4 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.8 kB 17.2 kB
createSSRApp 50.6 kB 19.9 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants