Skip to content

Commit

Permalink
Merge pull request #1924 from preactjs/fix/_children-should-keep-thei…
Browse files Browse the repository at this point in the history
…r-type-as-array

(fix) vnode._children should keep their type as array when diffing
  • Loading branch information
cristianbote authored Sep 13, 2019
2 parents 33c8360 + 285c982 commit 3262b5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/diff/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EMPTY_OBJ, EMPTY_ARR } from '../constants';
import { Component, enqueueRender } from '../component';
import { Fragment } from '../create-element';
import { diffChildren } from './children';
import { diffChildren, toChildArray } from './children';
import { diffProps } from './props';
import { assign, removeNode } from '../util';
import options from '../options';
Expand Down Expand Up @@ -118,7 +118,7 @@ export function diff(parentDom, newVNode, oldVNode, context, isSvg, excessDomChi

tmp = c.render(c.props, c.state, c.context);
let isTopLevelFragment = tmp != null && tmp.type == Fragment && tmp.key == null;
newVNode._children = isTopLevelFragment ? tmp.props.children : tmp;
newVNode._children = toChildArray(isTopLevelFragment ? tmp.props.children : tmp);

if (c.getChildContext!=null) {
context = assign(assign({}, context), c.getChildContext());
Expand Down

0 comments on commit 3262b5c

Please sign in to comment.