Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix location of SolidJS pre-hydration code #3140

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-pumas-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/solid-js': patch
---

Fix location of SolidJS pre-hydration code
5 changes: 5 additions & 0 deletions packages/integrations/solid/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
() =>
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/solid/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function renderToStaticMarkup(Component, props, children) {
})
);
return {
html: html + `<script>window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}})</script>`,
html: html,
};
}

Expand Down