Skip to content

Commit

Permalink
chore: changeset (#3873)
Browse files Browse the repository at this point in the history
  • Loading branch information
bholmesdev authored Jul 8, 2022
1 parent f9ed77b commit 957fb50
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/quiet-pugs-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix hydration for SSR components that return null
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/astro-island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare const Astro: {
public hydrator: any;
static observedAttributes = ['props'];
connectedCallback() {
if (this.getAttribute('client') === 'only' || this.firstChild) {
if (!this.getAttribute('await-children') || this.firstChild) {
this.childrenConnectedCallback();
} else {
// connectedCallback may run *before* children are rendered (ex. HTML streaming)
Expand Down
4 changes: 4 additions & 0 deletions packages/astro/src/runtime/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr

island.children = `${html ?? ''}${template}`;

if (island.children) {
island.props['await-children'] = ''
}

// Scripts to prepend
let prescriptType: PrescriptType = needsHydrationScript
? 'both'
Expand Down

0 comments on commit 957fb50

Please sign in to comment.