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

Ensure before-hydration is only loaded when used #4768

Merged
merged 2 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
client fix + changeset
  • Loading branch information
matthewp committed Sep 15, 2022
commit 5adc2b7f941fd44b0b1130bd275c697a8f8b5c5d
5 changes: 5 additions & 0 deletions .changeset/fluffy-eyes-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

nsure before-hydration is only loaded when used
5 changes: 4 additions & 1 deletion packages/astro/src/runtime/server/astro-island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ declare const Astro: {
}
async childrenConnectedCallback() {
window.addEventListener('astro:hydrate', this.hydrate);
await import(this.getAttribute('before-hydration-url')!);
let beforeHydrationUrl = this.getAttribute('before-hydration-url');
if(beforeHydrationUrl) {
await import(beforeHydrationUrl);
}
this.start();
}
start() {
Expand Down