Templating/binding detaches incorrect nested component when splicing from a databound array
When removing an item from an array bound to custom components with repeat.for="...", it is possible that an incorrect nested component is detached. This occurs only if the nested component is contained within another component that doesn't implement attached() or detached(). The workaround is to add one of these methods.
I ran into this issue while developing an application and managed to reproduce it here: https://gist.run/?id=e88ade5198924c5d2cf2
Note that in the reproducible, when the alert is shown, values remaining in the custom component are incorrect. After the alert is dismissed, correct data is bound to the custom component. Nevertheless, when detached() is called, it is called in the wrong viewmodel, so any custom logic in that method will be applied in an incorrect context.
@jdanyow @martingust I'm going to guess this has to do with some of the recent optimizations around lifecycle. Can you take a look?
reproducible in more recent build: https://gist.run/?id=173e62d9adfc6b776814