fix preact render to update a component on first render (#966)

* fix preact render to modify server-rendered code

* add changeset
This commit is contained in:
Fred K. Schott 2021-08-03 11:00:49 -07:00 committed by GitHub
parent 260d03b1b6
commit f7e86150e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/renderer-preact': patch
---
Fix an issue where preact component UI wouldn't update on hydrate

View file

@ -1,4 +1,4 @@
import { h, hydrate } from 'preact';
import { h, render } from 'preact';
import StaticHtml from './static-html.js';
export default (element) => (Component, props, children) => hydrate(h(Component, props, h(StaticHtml, { value: children })), element);
export default (element) => (Component, props, children) => render(h(Component, props, h(StaticHtml, { value: children })), element);