Closed AaronJPA closed 9 years ago
Thanks for the great repro! This is a well documented bug(s) and greatly appreciated.
It doesn't look like we can improve on this much. If the secondary path is deleted before the master, then this is just an update of the data--there's no real way to capture the intent until all the paths are gone. Attempting to defer the remove() operation until all paths return gets very complicated and tricky very quickly and potentially creates ordering issues.
It looks like the local remove could return an entire value with some trickiness and complexity, coupled with a good deal of refactoring, but the only consistent answer here would be to always return null as a value. Neither exactly match the API and we won't get any closer.
on('child_removed',...)
's snapshot does not contains the correct data.remove()
is used in NormalizedCollection's reference. It probably should have item's full data.on('child_changed',...)
showing the item without the data from the secondary path that was just removed and then aon('child_removed',...)
showing the last state of the item when it was finally removed from the master index.I'm opening four different issues because I'm not sure if they are related and, if they are not, they can be fixed separately. However, I used the same Plunker to simulate all of them, so it is a little bigger than usual. I tried to explain everything in the comments, but if something is not clear enough, just let me know.
http://plnkr.co/edit/Y0mp2XDtSQ0Pz9ClXctZ