Skip to content
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

Avoid removing existing dom nodes on subsequent replaceNode cal… #2274

Merged
merged 2 commits into from
Jan 23, 2020

Conversation

JoviDeCroock
Copy link
Member

Fixes: #2260
Fixes: #2264

We didn't correctly clean up existing nodes that weren't being replaced

@coveralls
Copy link

coveralls commented Jan 22, 2020

Coverage Status

Coverage increased (+0.07%) to 97.747% when pulling f2b8600 on fix-subsequent-replace-nodes into 9e3faa9 on master.

@@ -315,6 +315,7 @@ function diffElementNodes(
}
} else if (newVNode !== oldVNode) {
if (excessDomChildren != null) {
excessDomChildren[excessDomChildren.indexOf(dom)] = null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mutates the array that is still referenced in diffChildren

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very good find! Can only imagine how much time it took to debug this 👍

@marvinhagemeister marvinhagemeister changed the title Avoid removing existing dom nodes on subsequent replaceNode calls Avoid removing existing dom nodes on subsequent replaceNode cal… Jan 23, 2020
@marvinhagemeister marvinhagemeister merged commit 6cc97cd into master Jan 23, 2020
@marvinhagemeister marvinhagemeister deleted the fix-subsequent-replace-nodes branch January 23, 2020 05:37
porfirioribeiro pushed a commit to porfirioribeiro/preact that referenced this pull request Feb 3, 2020
…actjs#2274)

Avoid removing existing dom nodes on subsequent replaceNode calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants