summaryrefslogtreecommitdiff
path: root/packages/integrations/preact/static-html.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-09-21 15:21:21 -0400
committerGravatar GitHub <noreply@github.com> 2022-09-21 15:21:21 -0400
commit5e46be54683592773e6dfc2d33825493886114b0 (patch)
tree6a9ed635e986ae12037f13c47afe47c260f3bdf2 /packages/integrations/preact/static-html.js
parentbaae1b3fd10cf0a74e880c0e0552ba8d58f24453 (diff)
downloadastro-5e46be54683592773e6dfc2d33825493886114b0.tar.gz
astro-5e46be54683592773e6dfc2d33825493886114b0.tar.zst
astro-5e46be54683592773e6dfc2d33825493886114b0.zip
Support shared signals in Preact islands (#4763)
* Support signals in Preact islands * Add a changeset * Only add signals if we need them * Refactor signal logic into its own module * Keep track of the signals used
Diffstat (limited to 'packages/integrations/preact/static-html.js')
-rw-r--r--packages/integrations/preact/static-html.js24
1 files changed, 0 insertions, 24 deletions
diff --git a/packages/integrations/preact/static-html.js b/packages/integrations/preact/static-html.js
deleted file mode 100644
index 7e964ef06..000000000
--- a/packages/integrations/preact/static-html.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { h } from 'preact';
-
-/**
- * Astro passes `children` as a string of HTML, so we need
- * a wrapper `div` to render that content as VNodes.
- *
- * As a bonus, we can signal to Preact that this subtree is
- * entirely static and will never change via `shouldComponentUpdate`.
- */
-const StaticHtml = ({ value, name }) => {
- if (!value) return null;
- return h('astro-slot', { name, dangerouslySetInnerHTML: { __html: value } });
-};
-
-/**
- * This tells Preact to opt-out of re-rendering this subtree,
- * In addition to being a performance optimization,
- * this also allows other frameworks to attach to `children`.
- *
- * See https://preactjs.com/guide/v8/external-dom-mutations
- */
-StaticHtml.shouldComponentUpdate = () => false;
-
-export default StaticHtml;