Skip to content

Commit

Permalink
fix failing test by defaulting to empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Feb 16, 2020
1 parent ccd505e commit acb9512
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/diff/index.js
Expand Up @@ -5,6 +5,7 @@ import { diffChildren } from './children';
import { diffProps } from './props';
import { assign, removeNode } from '../util';
import options from '../options';
import { toChildArray } from '..';

/**
* Diff two virtual nodes and apply proper changes to the DOM
Expand Down Expand Up @@ -165,7 +166,9 @@ export function diff(
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 acb9512

Please sign in to comment.