Skip to content

Commit

Permalink
feat: add poc solution
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed May 12, 2019
1 parent 5e947e5 commit 6801688
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/diff/children.js
Expand Up @@ -33,6 +33,15 @@ export function diffChildren(parentDom, newParentVNode, oldParentVNode, context,

let oldChildrenLength = oldChildren.length;

// POC: solution
if (newChildren.length > oldChildren.length) {
// TODO: we only need a way to find this newIndex...
let newIndex = 0;
if (newIndex) {
oldChildren.splice(newIndex, 0, null);
}
}

// Only in very specific places should this logic be invoked (top level `render` and `diffElementNodes`).
// I'm using `EMPTY_OBJ` to signal when `diffChildren` is invoked in these situations. I can't use `null`
// for this purpose, because `null` is a valid value for `oldDom` which can mean to skip to this logic
Expand Down

0 comments on commit 6801688

Please sign in to comment.