This repository has been archived by the owner on Sep 24, 2021. It is now read-only.
Value linked to object prop does not update if object is passed to another component #17
Labels
client-side-reactivity
Reflection of updates to state on the view
ideas wanted
Needs imaginative ideas to make work
Given:
Executing:
SomeComponent
will see the updates and update its view but the text content of the h3 will stay the same.. This is because the component data tree referencesSomeComponent
s reactive data property undersomeObj
and that reactive data tree is isolated toSomeComponent
so it cannot bubble up changes to the main component.This is quite a tricky one and one that prevents some uses cases. For now one could collapse
SomeComponent
into the others dom:To fix this there would likely be changes to
observable.ts
and the data reactivity compilation. It would have to know that the object prop is used twice, one in its own component DOM and also passed to another component. It could then wrap / proxy it and make sure the changes are done both in its own DOM and passing the update down toSomeComponent
.This would still have the issue that if
SomeComponent
changes its own username from inside, whether this should bubble up to the parent importer. This is not possible in React and why their context library. Not sure whether it would be a good feature but certainly possible under compilation.There is also ways that #16 could help with this. Such as manual firing a method that could emit a event to the parent (importee) component so that it could update the h3 value...
The text was updated successfully, but these errors were encountered: