Closed juliangruber closed 7 years ago
Maybe there is cases though that I don't yet see where this would break?
actually..this is slower. But I don't understand, why.
This is what we tried initially but it's problematic because any given DOM node can only live in a single tree at any point in time. If a node, for whatever reason, is on two trees at the same time, it will unmount from one of the trees and trigger the corresponding on-load
events. That's why we went through all the trouble of using proxy nodes and .isSameNode()
checks to make sure the lifecycle events aren't triggered when they shouldn't.
Hope this makes sense. Thanks!
dang, ok yeah makes sense. thanks for clarifying!
https://github.com/moroshko/shallow-equal/pull/2#issuecomment-298434028 raised a concern that I didn't have an answer for, why do we even use
.isSameNode()
when we can just check for strict equality===
.Nanomorph will stop looking into a node's children when
a.isSameNode(b)
which is true whena === b
by default. So no need to even return the placeholder. As a bonus, we won't see the placeholder in the dom any more for cases where say people render and reorder lists without implementing theID
convention.