Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/diff/children.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function diffChildren(
/** @type {VNode[]} */
let oldChildren = oldParentVNode._children || EMPTY_ARR;

let newChildrenLength = renderResult.length;
let newChildrenLength = isArray(renderResult) ? renderResult.length : 1;

oldDom = constructNewChildrenArray(
newParentVNode,
Expand Down Expand Up @@ -184,7 +184,7 @@ function constructNewChildrenArray(
for (i = 0; i < newChildrenLength; i++) {
// @ts-expect-error We are reusing the childVNode variable to hold both the
// pre and post normalized childVNode
childVNode = renderResult[i];
childVNode = isArray(renderResult) ? renderResult[i] : renderResult;

if (
childVNode == NULL ||
Expand Down
4 changes: 2 additions & 2 deletions src/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export function diff(

oldDom = diffChildren(
parentDom,
isArray(renderResult) ? renderResult : [renderResult],
renderResult,
newVNode,
oldVNode,
globalContext,
Expand Down Expand Up @@ -677,7 +677,7 @@ function diffElementNodes(

diffChildren(
parentDom,
isArray(newChildren) ? newChildren : [newChildren],
newChildren,
newVNode,
oldVNode,
globalContext,
Expand Down
Loading