summaryrefslogtreecommitdiff
path: root/packages/integrations/react/server-v17.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2023-05-17 10:18:04 -0400
committerGravatar GitHub <noreply@github.com> 2023-05-17 10:18:04 -0400
commit3d525efc95cfb2deb5d9e04856d02965d66901c9 (patch)
treeaf1973aede0d2950d94b7ebfc957770be214446c /packages/integrations/react/server-v17.js
parente9fc2c2213036d47cd30a47a6cdad5633481a0f8 (diff)
downloadastro-3d525efc95cfb2deb5d9e04856d02965d66901c9.tar.gz
astro-3d525efc95cfb2deb5d9e04856d02965d66901c9.tar.zst
astro-3d525efc95cfb2deb5d9e04856d02965d66901c9.zip
Prevent removal of nested slots within islands (#7093)
* Prevent removal of nested slots within islands * Fix build errors
Diffstat (limited to 'packages/integrations/react/server-v17.js')
-rw-r--r--packages/integrations/react/server-v17.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/integrations/react/server-v17.js b/packages/integrations/react/server-v17.js
index ab5b06350..551b350d5 100644
--- a/packages/integrations/react/server-v17.js
+++ b/packages/integrations/react/server-v17.js
@@ -65,7 +65,11 @@ function renderToStaticMarkup(Component, props, { default: children, ...slotted
};
const newChildren = children ?? props.children;
if (newChildren != null) {
- newProps.children = React.createElement(StaticHtml, { value: newChildren });
+ newProps.children = React.createElement(StaticHtml, {
+ // Adjust how this is hydrated only when the version of Astro supports `astroStaticSlot`
+ hydrate: metadata.astroStaticSlot ? !!metadata.hydrate : true,
+ value: newChildren
+ });
}
const vnode = React.createElement(Component, newProps);
let html;
@@ -80,4 +84,5 @@ function renderToStaticMarkup(Component, props, { default: children, ...slotted
export default {
check,
renderToStaticMarkup,
+ supportsAstroStaticSlot: true,
};