Skip to content

fix(client): prevent overlay from closing immediately on runtime error at initial load#5653

Open
kehach07 wants to merge 6 commits intowebpack:mainfrom
kehach07:fix-overlay-runtime-error-initial-load
Open

fix(client): prevent overlay from closing immediately on runtime error at initial load#5653
kehach07 wants to merge 6 commits intowebpack:mainfrom
kehach07:fix-overlay-runtime-error-initial-load

Conversation

@kehach07
Copy link

…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, and ok, 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

@alexander-akait
Copy link
Member

is is AI generated code? Please add a test case


expect(overlay).not.toBeNull();
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use e2e overlay existing tests

Copy link
Author

@kehach07 kehach07 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

ovflowd
ovflowd previously approved these changes Mar 11, 2026

window.addEventListener("unhandledrejection", () => {
status.hasRuntimeError = true;
});
Copy link
Member

@alexander-akait alexander-akait Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code can be run in web workers and it will broken

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

window.addEventListener("unhandledrejection", () => {
status.hasRuntimeError = true;
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if the error happens in web worker? This will not work

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to search better solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants