You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have a question/proposal about direct props reactivity.
When a ref is binded to a child component, if the parent changes this ref value but does not read the ref value in other places of its template, the whole parent component is rerendered anyways. A way to avoid this would be to have an object prop for the child component, with the prop we want to assign to the ref in it, and for example pass a reactive as prop to this component.
Could it be a good idea to allow the same behavior for the first case ? I.e direct binded props to not be read directly by the parent but lazily read by the child component in order to have more fine grained reactivity ?
In this playground, the component Comp uses a direct prop msg, when this prop is updated via a ref, the whole app rerenders. The component Comp1 uses a prop params which is an object that should contain a msg field, when we pass a reactive object as prop for Comp1 and update the msg field of this reactive object, there is no rerender for the whole app.
Will vue implement the second behavior for Comp too by default to have more fine grained reactivity ? What are the difficulties to do this ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I have a question/proposal about direct props reactivity.
When a ref is binded to a child component, if the parent changes this ref value but does not read the ref value in other places of its template, the whole parent component is rerendered anyways. A way to avoid this would be to have an object prop for the child component, with the prop we want to assign to the ref in it, and for example pass a reactive as prop to this component.
Could it be a good idea to allow the same behavior for the first case ? I.e direct binded props to not be read directly by the parent but lazily read by the child component in order to have more fine grained reactivity ?
Here is a playground to present the question
In this playground, the component
Comp
uses a direct propmsg
, when this prop is updated via a ref, the whole app rerenders. The componentComp1
uses a propparams
which is an object that should contain amsg
field, when we pass a reactive object as prop forComp1
and update themsg
field of this reactive object, there is no rerender for the whole app.Will vue implement the second behavior for Comp too by default to have more fine grained reactivity ? What are the difficulties to do this ?
Thanks !
Beta Was this translation helpful? Give feedback.
All reactions