fix(client): prevent overlay from closing immediately on runtime error at initial load#5653
fix(client): prevent overlay from closing immediately on runtime error at initial load#5653kehach07 wants to merge 6 commits intowebpack:mainfrom
Conversation
…r at initial load
|
is is AI generated code? Please add a test case |
|
|
||
| expect(overlay).not.toBeNull(); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Please use e2e overlay existing tests
There was a problem hiding this comment.
Thanks for the suggestion. I moved the test into the existing overlay e2e tests.
It reproduces the runtime error on initial load and verifies that the overlay stays visible.
Let me know if anything else should be adjusted.
client-src/index.js
Outdated
|
|
||
| window.addEventListener("unhandledrejection", () => { | ||
| status.hasRuntimeError = true; | ||
| }); |
There was a problem hiding this comment.
This code can be run in web workers and it will broken
There was a problem hiding this comment.
Thanks for pointing this out. I’ve updated it to use self instead of window so it works correctly in web workers as well. Please take another look.
…ad and add e2e test
…ad and add e2e test
| window.addEventListener("unhandledrejection", () => { | ||
| status.hasRuntimeError = true; | ||
| }); | ||
| } |
There was a problem hiding this comment.
What about if the error happens in web worker? This will not work
alexander-akait
left a comment
There was a problem hiding this comment.
We need to search better solution
…r at initial load
Summary
What kind of change does this PR introduce?
Did you add tests for your changes?
Does this PR introduce a breaking change?
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Use of AI
Fixes an issue where the error overlay was closed immediately when a runtime error occurred during the initial page load.
Previously, the overlay was dismissed by socket events such as
invalid,still-ok, andok, even when a runtime error existed. This caused the runtime error overlay to disappear instantly, making debugging difficult.This change tracks runtime errors and prevents the overlay from being dismissed until the error is resolved.
Issue: #5024