Skip to content

Commit 0ef40bd

Browse files
fix: Prevent unstyled content during reload (#22)
Co-authored-by: me <[email protected]> Co-authored-by: Cursor Agent <[email protected]>
1 parent 8ba5da9 commit 0ef40bd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ function checkClientHints() {
8383
cookieChanged = true;
8484
}
8585
}
86-
if (cookieChanged) window.location.reload();
86+
if (cookieChanged) {
87+
// Hide the page content immediately to prevent visual flicker
88+
const style = document.createElement('style');
89+
style.textContent = 'html { visibility: hidden !important; }';
90+
document.head.appendChild(style);
91+
92+
// Trigger the reload
93+
window.location.reload();
94+
}
8795
}
8896
8997
checkClientHints();

0 commit comments

Comments
 (0)