1
1
import { encodeEntities , indent , isLargeString , styleObjToCss , assign , getChildren } from './util' ;
2
2
import { ENABLE_PRETTY } from '../env' ;
3
- import { options , Fragment } from 'preact' ;
3
+ import { options , Fragment , createElement } from 'preact' ;
4
4
5
5
const SHALLOW = { shallow : true } ;
6
6
@@ -39,6 +39,11 @@ function renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
39
39
return '' ;
40
40
}
41
41
42
+ // wrap array nodes in Fragment
43
+ if ( Array . isArray ( vnode ) ) {
44
+ vnode = createElement ( Fragment , null , vnode ) ;
45
+ }
46
+
42
47
let nodeName = vnode . type ,
43
48
props = vnode . props ,
44
49
isComponent = false ;
@@ -71,7 +76,7 @@ function renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
71
76
}
72
77
else {
73
78
let rendered ;
74
-
79
+
75
80
let c = vnode . __c = { __v : vnode , context, props : vnode . props } ;
76
81
if ( options . render ) options . render ( vnode ) ;
77
82
@@ -98,7 +103,7 @@ function renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
98
103
else if ( c . componentWillMount ) c . componentWillMount ( ) ;
99
104
rendered = c . render ( c . props , c . state , c . context ) ;
100
105
}
101
-
106
+
102
107
if ( c . getChildContext ) {
103
108
context = assign ( assign ( { } , context ) , c . getChildContext ( ) ) ;
104
109
}
0 commit comments