Callbacks for watching multiple props sources differ from wrapped callbacks in components
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 54.4k
- Forks
- 9.2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 140
Description
Vue version
^3.2.47
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-izrti9?file=src%2FApp.vue
Steps to reproduce
Go to reproduction.
And make code like this.
// in App.vue
- <CompB :foo="model.foo" :bar="model.bar" />
+ <CompWrapper>
+ <CompB :foo="model.foo" :bar="model.bar" />
+ </CompWrapper>
And change input value
What is expected?
Change input value once to callback console.log('CompB props changed') twice in CompB.vue.
It should not behave differently when make code like this.
// in App.vue
+ <CompB :foo="model.foo" :bar="model.bar" />
- <CompWrapper>
- <CompB :foo="model.foo" :bar="model.bar" />
- </CompWrapper>
What is actually happening?
Change input value once to callback console.log('CompB props changed') once in CompB.vue.
In other words,the number of watch callbacks is consistent with the watch([() => model.foo, () => model.bar] in App.vue
System Info
No response
Any additional comments?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and compare the direct and wrapped cases in App.vue, CompB.vue, and CompWrapper. Trace how the multiple-props watch callback behaves in each case, then verify that changing the input produces the same callback count in both arrangements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100