summaryrefslogtreecommitdiff
path: root/packages/integrations/preact/client.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2022-05-31 11:29:36 -0500
committerGravatar GitHub <noreply@github.com> 2022-05-31 11:29:36 -0500
commite9a77d861907adccfa75811f9aaa555f186d78f8 (patch)
tree1c77ae43165a7f529ea5762811798c3873f1776c /packages/integrations/preact/client.js
parent40614597ccef567afab31621834037b0a77ed317 (diff)
downloadastro-e9a77d861907adccfa75811f9aaa555f186d78f8.tar.gz
astro-e9a77d861907adccfa75811f9aaa555f186d78f8.tar.zst
astro-e9a77d861907adccfa75811f9aaa555f186d78f8.zip
Improve nested and `client:only` hydration (#3455)
* wip: fix nested islands * fix: improve hydration for dynamic content * chore: fix bundle-size script for new files * chore: allow-list client:* directive files * fix(#3362): fix client:only behavior for React, Vue, Solid * test: add client-only e2e test * chore: update lockfile * test: fix e2e tests * test: add framework nesting e2e tests * Update packages/astro/src/runtime/client/events.ts Co-authored-by: Matthew Phillips <matthew@skypack.dev> * chore: add changeset * fix(preact): ignore hydrate roots * chore: remove `ssr` check in integrations * Revert "chore: remove `ssr` check in integrations" This reverts commit ba27eaae5514701f4b7bb6259f682fe82821a23d. * chore: add changeset Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'packages/integrations/preact/client.js')
-rw-r--r--packages/integrations/preact/client.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/integrations/preact/client.js b/packages/integrations/preact/client.js
index 5ece5ddb2..6ff40d2ae 100644
--- a/packages/integrations/preact/client.js
+++ b/packages/integrations/preact/client.js
@@ -1,8 +1,10 @@
import { h, render } from 'preact';
import StaticHtml from './static-html.js';
-export default (element) => (Component, props, children) =>
+export default (element) => (Component, props, children) => {
+ if (!element.hasAttribute('ssr')) return;
render(
h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
element
);
+}