diff --git a/.changeset/eight-pumas-repeat.md b/.changeset/eight-pumas-repeat.md new file mode 100644 index 000000000000..7058e360fec4 --- /dev/null +++ b/.changeset/eight-pumas-repeat.md @@ -0,0 +1,5 @@ +--- +'@astrojs/solid-js': patch +--- + +Fix location of SolidJS pre-hydration code diff --git a/packages/integrations/solid/client.js b/packages/integrations/solid/client.js index 4424e9b98526..f85bd8a23f0b 100644 --- a/packages/integrations/solid/client.js +++ b/packages/integrations/solid/client.js @@ -2,6 +2,11 @@ import { sharedConfig } from 'solid-js'; import { hydrate, createComponent } from 'solid-js/web'; export default (element) => (Component, props, childHTML) => { + // Prepare global object expected by Solid's hydration logic + if (!window._$HY) { + window._$HY = { events: [], completed: new WeakSet, r: {} }; + } + // Perform actual hydration let children; hydrate( () => diff --git a/packages/integrations/solid/server.js b/packages/integrations/solid/server.js index ccee482eaa31..636fa50f6bc6 100644 --- a/packages/integrations/solid/server.js +++ b/packages/integrations/solid/server.js @@ -20,7 +20,7 @@ function renderToStaticMarkup(Component, props, children) { }) ); return { - html: html + ``, + html: html, }; }