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): watchEffect should deduplicate multiple onCleanup calls for the same function #12394

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

Conversation

shengxj1
Copy link

fix #3341

@edison1105 edison1105 added scope: reactivity wait changes 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels Nov 15, 2024
@edison1105 edison1105 changed the title fix(reactivity): watchEffect should allow multiple onCleanup calls fix(reactivity): watchEffect should deduplicate multiple onCleanup calls for the same function Nov 18, 2024
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 99.8 kB (-239 B) 37.9 kB (-59 B) 34.2 kB (-48 B)
vue.global.prod.js 158 kB (-239 B) 57.7 kB (-61 B) 51.3 kB (-90 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47.1 kB (-103 B) 18.3 kB (-18 B) 16.8 kB (+34 B)
createApp 55.1 kB (-90 B) 21.3 kB (-19 B) 19.5 kB (-26 B)
createSSRApp 59.1 kB (-152 B) 23 kB (-28 B) 20.9 kB (-39 B)
defineCustomElement 60 kB (-88 B) 22.9 kB (-22 B) 20.8 kB (-14 B)
overall 68.9 kB (-193 B) 26.4 kB (-61 B) 24 kB (-122 B)

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@12394

@vue/compiler-dom

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

@vue/compiler-ssr

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

@vue/compiler-sfc

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 6a13a05

@edison1105 edison1105 added ready to merge The PR is ready to be merged. and removed wait changes labels Nov 18, 2024
@skirtles-code
Copy link
Contributor

I'm unclear what the motivation is behind this change. Why do we need to deduplicate?

If the callback function is stateful (e.g. calling pop() on a stack) then calling it multiple times might be important. I don't know how realistic that kind of use case is in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. 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.

watchEffect should allow multiple onInvalidate calls
3 participants