diff options
author | 2023-05-26 22:37:33 +0800 | |
---|---|---|
committer | 2023-05-26 22:37:33 +0800 | |
commit | 1c77779dd66a6db77c81ed235da076a6118decde (patch) | |
tree | f013ae2df6f5820ef4c006e980de9d46e2c36e4b /packages/integrations | |
parent | 6c7df28ab34b756b8426443bf6976e24d4611a62 (diff) | |
download | astro-1c77779dd66a6db77c81ed235da076a6118decde.tar.gz astro-1c77779dd66a6db77c81ed235da076a6118decde.tar.zst astro-1c77779dd66a6db77c81ed235da076a6118decde.zip |
Fix `astro-static-slot` hydration mismatch error (#7196)
Diffstat (limited to 'packages/integrations')
-rw-r--r-- | packages/integrations/preact/src/static-html.ts | 4 | ||||
-rw-r--r-- | packages/integrations/react/static-html.js | 2 | ||||
-rw-r--r-- | packages/integrations/vue/static-html.js | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/packages/integrations/preact/src/static-html.ts b/packages/integrations/preact/src/static-html.ts index f0fbd885c..453e72b7f 100644 --- a/packages/integrations/preact/src/static-html.ts +++ b/packages/integrations/preact/src/static-html.ts @@ -13,9 +13,9 @@ type Props = { * As a bonus, we can signal to Preact that this subtree is * entirely static and will never change via `shouldComponentUpdate`. */ -const StaticHtml = ({ value, name, hydrate }: Props) => { +const StaticHtml = ({ value, name, hydrate = true }: Props) => { if (!value) return null; - const tagName = hydrate === false ? 'astro-static-slot' : 'astro-slot'; + const tagName = hydrate ? 'astro-slot' : 'astro-static-slot'; return h(tagName, { name, dangerouslySetInnerHTML: { __html: value } }); }; diff --git a/packages/integrations/react/static-html.js b/packages/integrations/react/static-html.js index 37fda1983..e319a40c7 100644 --- a/packages/integrations/react/static-html.js +++ b/packages/integrations/react/static-html.js @@ -7,7 +7,7 @@ import { createElement as h } from 'react'; * As a bonus, we can signal to React that this subtree is * entirely static and will never change via `shouldComponentUpdate`. */ -const StaticHtml = ({ value, name, hydrate }) => { +const StaticHtml = ({ value, name, hydrate = true }) => { if (!value) return null; const tagName = hydrate ? 'astro-slot' : 'astro-static-slot'; return h(tagName, { diff --git a/packages/integrations/vue/static-html.js b/packages/integrations/vue/static-html.js index 34740f88f..885319026 100644 --- a/packages/integrations/vue/static-html.js +++ b/packages/integrations/vue/static-html.js @@ -10,7 +10,10 @@ const StaticHtml = defineComponent({ props: { value: String, name: String, - hydrate: Boolean, + hydrate: { + type: Boolean, + default: true, + }, }, setup({ name, value, hydrate }) { if (!value) return () => null; |