refactor(reactivity): unnecessarily func call
Hello! There are some trouble when we try to find a value form a reactive array. If the arg was a raw value and the target array had not included it, the findValue function will still execute twice. It's unnecessary I think. Maybe we can resolve it by adding a condition.
Can you provide sample code where this happens? Ideally there should be a test case to demonstrate this.
Size Report
Bundles
| File | Size | Gzip | Brotli |
|---|---|---|---|
| runtime-dom.global.prod.js | 101 kB | 38.1 kB | 34.2 kB |
| vue.global.prod.js | 160 kB | 58 kB | 51.5 kB |
Usages
| Name | Size | Gzip | Brotli |
|---|---|---|---|
| createApp (CAPI only) | 49.1 kB | 18.9 kB | 17.3 kB |
| createApp | 55.7 kB | 21.4 kB | 19.6 kB |
| createSSRApp | 59.7 kB | 23.1 kB | 21 kB |
| defineCustomElement | 60.4 kB | 23 kB | 20.9 kB |
| overall | 69.4 kB | 26.5 kB | 24.1 kB |
Can you provide sample code where this happens? Ideally there should be a test case to demonstrate this.
Hi, Evan. I have added some test cases, and here is the sample code. @yyx990803
It's already fixed by https://github.com/vuejs/core/pull/9511/files#diff-2b8c2b531651dd15cee7c2b11e34972f4a4903c114e94e74c0e94bb10f03ed0fR291, but no related test cases were added in #9511, maybe we should keep the test cases in this PR.
@vue/compiler-core
pnpm add https://pkg.pr.new/@vue/compiler-core@11328
@vue/compiler-dom
pnpm add https://pkg.pr.new/@vue/compiler-dom@11328
@vue/compiler-sfc
pnpm add https://pkg.pr.new/@vue/compiler-sfc@11328
@vue/compiler-ssr
pnpm add https://pkg.pr.new/@vue/compiler-ssr@11328
@vue/reactivity
pnpm add https://pkg.pr.new/@vue/reactivity@11328
@vue/runtime-core
pnpm add https://pkg.pr.new/@vue/runtime-core@11328
@vue/runtime-dom
pnpm add https://pkg.pr.new/@vue/runtime-dom@11328
@vue/server-renderer
pnpm add https://pkg.pr.new/@vue/server-renderer@11328
@vue/shared
pnpm add https://pkg.pr.new/@vue/shared@11328
vue
pnpm add https://pkg.pr.new/vue@11328
@vue/compat
pnpm add https://pkg.pr.new/@vue/compat@11328
commit: 65e27cf
It's already fixed by https://github.com/vuejs/core/pull/9511/files#diff-2b8c2b531651dd15cee7c2b11e34972f4a4903c114e94e74c0e94bb10f03ed0fR291, but no related test cases were added in #9511, maybe we should keep the test cases in this PR.
Sorry for closed, I didn't notice the last part.