-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New beforeRemove behavior can break non-removed items #1903
Conversation
I'm glad you found this, because I was seeing issues in my project related to |
@ThomasMichon I'm not sure if this is the same problem as you're describing because I didn't ever see a |
…eted nodes even when some are removed (including the first and last nodes).
@rniemeyer Could you please review these changes? |
@@ -275,8 +282,10 @@ ko.utils = (function () { | |||
while (current !== last) { | |||
continuousNodeArray.push(current); | |||
current = current.nextSibling; | |||
if (!current) // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario) | |||
return; | |||
if (!current) { // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the change above (new rule B), we can probably remove this check since the last node should always be there. What do you think, @rniemeyer?
@mbest - I'lll review as soon as I can |
@mbest this looks good and I agree that it should be safe to remove the check that you commented on. |
New beforeRemove behavior can break non-removed items
Thanks, @rniemeyer. I've merged this now. |
While re-testing the examples included with #1256, I discovered that when removing items from an array, following items might be "cleaned" so that their bindings no longer worked. This happens when the nodes for an item aren't all removed at the same time and
fixUpContinuousNodeArray
exits with the "undefined scenario".