Subscribe on changes!

dependency collection failures, changes to unused props also trigger render

avatar
Nov 3rd 2021

Version

3.2.21

Reproduction link

sfc.vuejs.org/

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.

avatar
Nov 3rd 2021

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

avatar
Nov 4th 2021

It is Intentional.It involves active update or passive update of components. You can use object to aviod unnessary update. sfc.vuejs.org/

avatar
Nov 5th 2021

image

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

avatar
Nov 5th 2021

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).

avatar
Nov 7th 2021

duplicated of #1181