How to handle Typescript class instances as props? #7859
Unanswered
mitjans
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! Yesterday I asked a question on
r/vuejs
, and would like to share it with you as well.Situation:
I've noticed that the first node passed as a prop to the child component won't be reactive to new nodes being appended at the end of the list. I've managed to overcome this problem passing a new "dummy" prop to the child that changes everytime a new node is appended (this change triggers Vue reactivity system and forces an update on the child component).
On this example, removing the `force` property on the child component will brake the reactivity. The child won't be notified when new nodes are appended on the list.
Is there a more elegant way of handling situations like this?
Some links with more information on this:
Someone suggested using a
customRef
wrapper. Although I like the idea of creating a wrapper, I don't see how it could be done in the example provided.I've also tried using a
shallowRef
and trigger a reactivity change withtriggerRef
, but the reactivity change only affects the parent component. In this Github comment, there's an example of this.Beta Was this translation helpful? Give feedback.
All reactions