Skip to content

Commit

Permalink
wait for DOMContentLoaded in csr script (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
andnorda authored Jul 2, 2024
1 parent 7719566 commit ba94058
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/client/src/csr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ async function hydrate() {
.forEach((script) => document.body.appendChild(script));
}

hydrate();
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", hydrate);
} else {
hydrate();
}

0 comments on commit ba94058

Please sign in to comment.