If a provider has multiple children then the result of a render is an array of VNodes. RenderToString tries to fetch the nodeName of this array on line 180: s = `<${nodeName}${s}>`; . The result is the string <undefined>.
This breaks server side rendering of valid Preact applications.
const TestContext = createContext();
function TestComponent() {
return <TestContext.Provider>
<div>1</div>
<div>2</div>
</TestContext.Provider>
}
Preact 10.0.0-beta.2 handles this case by coercing the array to a fragment:
if (Array.isArray(possibleVNode)) {
return createElement(Fragment, null, possibleVNode);
}
Maybe preact-render-to-string should coerce the render result to vnodes too?