Skip to content

Commit 6110319

Browse files
committed
fix(client): keep overlay visible for runtime error during initial load and add e2e test
1 parent 6f04d94 commit 6110319

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

client-src/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ const status = {
8787
currentHash: __webpack_hash__,
8888
hasRuntimeError: false,
8989
};
90-
window.addEventListener("error", () => {
91-
status.hasRuntimeError = true;
92-
});
90+
if (typeof window !== "undefined") {
91+
window.addEventListener("error", () => {
92+
status.hasRuntimeError = true;
93+
});
9394

94-
window.addEventListener("unhandledrejection", () => {
95-
status.hasRuntimeError = true;
96-
});
95+
window.addEventListener("unhandledrejection", () => {
96+
status.hasRuntimeError = true;
97+
});
98+
}
9799
/**
98100
* @returns {string} current script source
99101
*/

0 commit comments

Comments
 (0)