Move child reodering to diffChildren#2813
Conversation
📊 Tachometer Benchmark ResultsSummaryduration
window.usedJSHeapSize
Results02_replace1kduration
window.usedJSHeapSize
03_update10th1k_x16duration
window.usedJSHeapSize
many_updatesduration
window.usedJSHeapSize
text_updateduration
window.usedJSHeapSize
|
|
Size Change: -17 B (0%) Total Size: 41.8 kB
ℹ️ View Unchanged
|
123b355 to
bf2e9d9
Compare
| vnode._parent = childVNode; | ||
|
|
||
| if (typeof vnode.type == 'function') { | ||
| reorderChildren(vnode, oldDom, parentDom); |
There was a problem hiding this comment.
We'd need to find a way to tell whether or not we have to traverse further:
const Cell = () => (
<Fragment>
<div>x</div>
<Fragment><div>y</div></Fragment>
</Fragment>
)
When this Cell bails we need to ensure we move y as well as x when this is moved from the top. Before this change we would forget about y within diffChildren but move it from diff.shouldComponentUpdate = false.
| ); | ||
| if ( | ||
| typeof childVNode.type == 'function' && | ||
| childVNode._children === oldVNode._children |
There was a problem hiding this comment.
This signals that we bailed out either due to strict equality or SCU false
marvinhagemeister
left a comment
There was a problem hiding this comment.
This looks really great! In the longterm I think we have to go with moving the placing of children into diffChildren either way 👍
Does this change catch a new bugs where we'd need a test for or is it mostly byte savings?
|
@marvinhagemeister mainly savings and readability |
We used to reorder within the scope of a single bailed vnode diff, we're in a better position when we are currently inside of a
diffChildrento correctly hand offoldDomto the next node.