pomber/didact

Duplicate deletion commit

EnrigleZ opened this issue · 0 comments

Thanks for your blog and code sharing, Didact is awesome!

I got an issue here when I tried to delete several siblings in the same time.

didact/didact.js

Lines 124 to 129 in a127ff4

} else if (fiber.effectTag === "DELETION") {
commitDeletion(fiber, domParent)
}
commitWork(fiber.child)
commitWork(fiber.sibling)

In this line, after one fiber gets deleted, its sibling will commitWork next, which has been already registered in deletions.

As a result, some fiber will be deleted more than once (after its sibling and in deletions.forEach), which will cause an error.