dependency collection failures, changes to unused props also trigger render
Version
3.2.21
Reproduction link
Steps to reproduce
Open your browser's console
What is expected?
The log
will only be executed once.
What is actually happening?
The log
is executed all the time.
This might be expected as passed props are used in the generated JS to know when to render again.
You can use v-memo="msg"
(or [msg]) to tell the component not to render if msg didn't change
It is Intentional.It involves active update or passive update of components. You can use object to aviod unnessary update. sfc.vuejs.org/
https://v3.vuejs.org/guide/reactivity.html#how-vue-tracks-these-changes
Does this seem inconsistent with the description in the documentation, or is there a problem with my understanding? In addition, in vue2.x, the behavior is what I expected. see: https://codesandbox.io/s/nifty-smoke-8tz7n?file=/src/App.vue
I think this has been raised before and was marked as enhancement. TLDR: the current behavior ensures correctness in edge cases, especially when $attrs
are involved (which are non-reactive).