Skip to content

Commit 8f95e7e

Browse files
committed
fix issue
1 parent 398ed07 commit 8f95e7e

2 files changed

Lines changed: 4 additions & 17 deletions

File tree

src/diff/children.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ export function diffChildren(
116116
childVNode._flags & INSERT_VNODE ||
117117
oldVNode._children === childVNode._children
118118
) {
119+
if (!newDom && oldVNode._dom == oldDom) {
120+
oldDom = getDomSibling(oldVNode);
121+
}
119122
oldDom = insert(childVNode, oldDom, parentDom);
120123
} else if (
121124
typeof childVNode.type == 'function' &&
@@ -229,11 +232,6 @@ function constructNewChildrenArray(newParentVNode, renderResult, oldChildren) {
229232

230233
const skewedIndex = i + skew;
231234

232-
console.log(
233-
'hi',
234-
childVNode && childVNode.type,
235-
childVNode && childVNode.key
236-
);
237235
// Handle unmounting null placeholders, i.e. VNode => null in unkeyed children
238236
if (childVNode == null) {
239237
oldVNode = oldChildren[skewedIndex];
@@ -244,17 +242,8 @@ function constructNewChildrenArray(newParentVNode, renderResult, oldChildren) {
244242
(oldVNode._flags & MATCHED) === 0
245243
) {
246244
if (oldVNode._dom == newParentVNode._nextDom) {
247-
console.log(newParentVNode._parent._nextDom);
248-
if (newParentVNode._parent._nextDom === oldVNode._dom) {
249-
newParentVNode._parent._nextDom = getDomSibling(oldVNode);
250-
}
251245
newParentVNode._nextDom = getDomSibling(oldVNode);
252246
}
253-
console.log(
254-
'setting early unmount',
255-
newParentVNode.type,
256-
newParentVNode._nextDom
257-
);
258247

259248
unmount(oldVNode, oldVNode, false);
260249

@@ -386,7 +375,6 @@ function insert(parentVNode, oldDom, parentDom) {
386375
oldDom = oldDom && oldDom.nextSibling;
387376
} while (oldDom != null && oldDom.nodeType === 8);
388377

389-
console.log('returning from insert', oldDom);
390378
return oldDom;
391379
}
392380

test/browser/render.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ describe('render()', () => {
15381538
);
15391539
});
15401540

1541-
it.only('should shrink lists', () => {
1541+
it('should shrink lists', () => {
15421542
function RenderedItem({ item }) {
15431543
if (item.renderAsNullInComponent) {
15441544
return null;
@@ -1576,7 +1576,6 @@ describe('render()', () => {
15761576
'<div><div>One</div><div>Two</div><div>Three</div><div>Four</div></div>'
15771577
);
15781578

1579-
console.log('---');
15801579
render(<App list={secondList} />, scratch);
15811580
expect(scratch.innerHTML).to.equal(
15821581
'<div><div>One</div><div>Six</div><div>Seven</div></div>'

0 commit comments

Comments
 (0)