Subscribe on changes!

The shallowReactive Api deep data changed can cause the view to be update

avatar
May 21st 2021

deep data change does not trigger watch, but it is still a data change (e.g. shallowReactiveState.age.number is still modified). So if anyone tries to pull the data, he will see the 1000 rather than the original 99.

Then there is the scope of DOM update. There are optimizations built in so that Vue does not re-render your entire app whenever something changes, but still the scope is not down to every single tiny place where a property is used (default is component scope?). So as long as there is some other stuff triggers an update, vue will figure out the scope of the dom to recalculate and if that scope includes the age.number, the change will be pulled in.

avatar
May 21st 2021

deep data change does not trigger watch, but it is still a data change (e.g. shallowReactiveState.age.number is still modified). So if anyone tries to pull the data, he will see the 1000 rather than the original 99.

Then there is the scope of DOM update. There are optimizations built in so that Vue does not re-render your entire app whenever something changes, but still the scope is not down to every single tiny place where a property is used (default is component scope?). So as long as there is some other stuff triggers an update, vue will figure out the scope of the dom to recalculate and if that scope includes the age.number, the change will be pulled in.

Thanks! I get it! The shallowReactive Api is actually an optimization way to avoid re-render。

avatar
May 21st 2021

deep data change does not trigger watch, but it is still a data change (e.g. shallowReactiveState.age.number is still modified). So if anyone tries to pull the data, he will see the 1000 rather than the original 99.

Then there is the scope of DOM update. There are optimizations built in so that Vue does not re-render your entire app whenever something changes, but still the scope is not down to every single tiny place where a property is used (default is component scope?). So as long as there is some other stuff triggers an update, vue will figure out the scope of the dom to recalculate and if that scope includes the age.number, the change will be pulled in.

I want to know which businesses can use it