fix(preact): ignore hydrate roots

This commit is contained in:
Nate Moore 2022-05-27 14:14:28 -05:00
parent 16de67faff
commit 95e560ec41

View file

@ -1,8 +1,10 @@
import { h, render } from 'preact'; import { h, render } from 'preact';
import StaticHtml from './static-html.js'; import StaticHtml from './static-html.js';
export default (element) => (Component, props, children) => export default (element) => (Component, props, children) => {
if (!element.hasAttribute('ssr')) return;
render( render(
h(Component, props, children != null ? h(StaticHtml, { value: children }) : children), h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
element element
); );
}