I am thinking that it is useful to not clear componentParent on destroy of a component. How it currently works is that when a component is created, componentParent and (corresponding children entry) is created. And when the component is destroyed, this it is cleared.
But this does not work well with a pattern where you are reusing components. In some cases it is better to create components in advance and then render them when needed. So same component is rendered multiple times. And components have a persistent hierarchy, and some of them gets rendered and some removed. But components are there all the time. And sometimes you then want to walk up and down the hierarchy even if the component is not rendered to still update its internal state. So that when it gets rendered again, the state is set.
So this would be slightly backwards incompatible. To get current behavior you should filter results from componentParent and componentChildren using isCreated. But I am not sure if people really depend on this behavior?
I am thinking that it is useful to not clear
componentParent
on destroy of a component. How it currently works is that when a component is created,componentParent
and (corresponding children entry) is created. And when the component is destroyed, this it is cleared.But this does not work well with a pattern where you are reusing components. In some cases it is better to create components in advance and then render them when needed. So same component is rendered multiple times. And components have a persistent hierarchy, and some of them gets rendered and some removed. But components are there all the time. And sometimes you then want to walk up and down the hierarchy even if the component is not rendered to still update its internal state. So that when it gets rendered again, the state is set.
So this would be slightly backwards incompatible. To get current behavior you should filter results from
componentParent
andcomponentChildren
usingisCreated
. But I am not sure if people really depend on this behavior?cc @Retronator