I accidentally discovered that useValue uses an incorrect logic to replace childComponents array, which led to some onUnmount callbacks being called multiple times (and others potentially never).
Another thing here is that we reverse the onUnmount calls, this way we unmount children first, and parent after that, which should be more logical. I don't use it anywhere, and in general it is common not to guarantee the execution order for such things, but I think it makes more sense. It might change in the future if I add promises support to components.
Description
I accidentally discovered that
useValue
uses an incorrect logic to replacechildComponents
array, which led to someonUnmount
callbacks being called multiple times (and others potentially never).Another thing here is that we reverse the
onUnmount
calls, this way we unmount children first, and parent after that, which should be more logical. I don't use it anywhere, and in general it is common not to guarantee the execution order for such things, but I think it makes more sense. It might change in the future if I add promises support to components.