appyx
appyx copied to clipboard
Node Lifecycle
Hello there, more a question than an issue.
I've the following configuration : a ParentNode
with 1 child Node
.
I'm listening to the Lifecycle
of each Node
to make some init/cleanup
init {
lifecycle.subscribe(
onCreate = {
},
onDestroy = {
}
)
}
When using navigateUp
on the child Node
, the ParentNode
enters onDestroy
before his child Node
. I'd have expected the opposite actually. Is it expected?
Thanks!
@zsoltk any thoughts on this? I'd like to wait for all my children to be destroyed before doing some clean-up.
@KovalevAndrey just bumping on this as it's still creating issues for us.
Is there any reason why a child onDestroy
is called after his parent onDestroy
?
Any other way we could synchronise on this?
@ganfra sorry for the late response. Atm there's no mechanism implemented to guarantee the lifecycle order. Children are moved toDESTROYED
state when the parent's lifecycle scope is cancelled. To support that we'd need to re-think the approach. What's the problem you're trying to solve that you care about the order? Perhaps, there's another way to solve this?