summaryrefslogtreecommitdiff
path: root/packages/integrations/preact/src/static-html.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/preact/src/static-html.ts')
-rw-r--r--packages/integrations/preact/src/static-html.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/integrations/preact/src/static-html.ts b/packages/integrations/preact/src/static-html.ts
index e1127d226..c1e44515f 100644
--- a/packages/integrations/preact/src/static-html.ts
+++ b/packages/integrations/preact/src/static-html.ts
@@ -1,5 +1,11 @@
import { h } from 'preact';
+type Props = {
+ value: string;
+ name?: string;
+ hydrate?: boolean;
+}
+
/**
* Astro passes `children` as a string of HTML, so we need
* a wrapper `div` to render that content as VNodes.
@@ -7,9 +13,10 @@ import { h } from 'preact';
* As a bonus, we can signal to Preact that this subtree is
* entirely static and will never change via `shouldComponentUpdate`.
*/
-const StaticHtml = ({ value, name }: { value: string; name?: string }) => {
+const StaticHtml = ({ value, name, hydrate }: Props) => {
if (!value) return null;
- return h('astro-slot', { name, dangerouslySetInnerHTML: { __html: value } });
+ const tagName = hydrate === false ? 'astro-static-slot' : 'astro-slot';
+ return h(tagName, { name, dangerouslySetInnerHTML: { __html: value } });
};
/**