-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Show error message on React render error instead of empty screen #843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an error boundary to provide a user-visible error message when a React render error occurs, replacing the previous empty screen behavior. Key changes include:
- Addition of the KiloCodeErrorBoundary component in TypeScript.
- Integration of the error boundary into the main App component.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| webview-ui/src/kilocode/KiloCodeErrorBoundary.tsx | Introduces a React error boundary component that displays error details. |
| webview-ui/src/App.tsx | Wraps the application component tree with the error boundary. |
| this.state = {} | ||
| } | ||
|
|
||
| static getDerivedStateFromError(error: unknown) { |
Copilot
AI
Jun 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a componentDidCatch lifecycle method to log error details (error and errorInfo) for better debugging, as getDerivedStateFromError only updates the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have telemetry currently
hassoncs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! I'm kinda shocked we didn't have something like this already!
markijbema
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this fixes the blank screen of death? That would at least make debugging the root cause a lot easier
That's what I hope. Throwing an exception from render code did result in a blank screen. |
|
your test looks really good one it is in F5/debug mode, but did you try building the application and trigger the error? Correct me if I'm wrong, but your stack trace will not be readable because of production minification and such. |
|
The stack trace won't be readable, but the message will be I hope. |
|
You could try this library: https://www.stacktracejs.com/ but I'm not sure if we ship the required source maps (we probably should though) |
awesome thank you for your help! |
#735