Reactivity problem when using subclass instance
Version
3.2.22
Reproduction link
Steps to reproduce
Click first button: Message is added to "parent.messages" array, dom update is triggered.
Click second button: Message is added to "parent.messages" array via callback function in subclass instance, dom update is not triggered.
New messages are only rendered after clicking again on the first button.
What is expected?
Trigger dom update when clicking the second button.
What is actually happening?
No dom update is triggered when clicking the second button.
I guess this is somehow related to the internal use of proxies, however this isn't the typical kind of identity problem, is it?
This happens because the this
in this.addMessage()
inside of constructor()
of Parent is not the reactive proxy created with ref()
and thus doesn't trigger anything. You need to ensure the this
is the parent.value
, the reactive proxy like this for example