Skip to content

feat(frontend): add ErrorBoundary component to prevent full-app crashes#275

Merged
MoeidHeidari merged 2 commits into
crossplane-contrib:pre-releasefrom
bhavyamsharmaa:feat/add-error-boundary
Jun 13, 2026
Merged

feat(frontend): add ErrorBoundary component to prevent full-app crashes#275
MoeidHeidari merged 2 commits into
crossplane-contrib:pre-releasefrom
bhavyamsharmaa:feat/add-error-boundary

Conversation

@bhavyamsharmaa

@bhavyamsharmaa bhavyamsharmaa commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • Added ErrorBoundary class component in src/presentation/components/common/ErrorBoundary.jsx
  • Wrapped the top-level <Routes> in App.jsx with <ErrorBoundary> so any render-time exception is caught app-wide
  • Fallback UI matches the existing server error screen style (same Chakra layout, icons, dark mode support, reload button)

Why

React does not catch render-time exceptions with try/catch — only an Error Boundary (class component with getDerivedStateFromError) can do that. Without this, any unhandled render error causes a blank white screen with no recovery path. With the boundary in place, users see a proper error screen and can reload instead of being stuck on a blank page.

Test plan

  • Trigger a render error manually (throw inside a component) and verify the fallback UI appears instead of a blank screen
  • Verify the Reload Page button reloads the app
  • Verify dark mode styling looks correct on the fallback screen
  • Verify normal app flow is unaffected (no visual change when no error occurs)
  • npm run build passes with no errors

Closes #274

Screenshot

Before (no ErrorBoundary) — blank white screen:

After (with ErrorBoundary) — fallback UI with reload option:
After

@bhavyamsharmaa bhavyamsharmaa force-pushed the feat/add-error-boundary branch from 3580968 to a4b7084 Compare June 11, 2026 11:06
@MoeidHeidari

Copy link
Copy Markdown
Collaborator

hi @bhavyamsharmaa, that is a nice catch. thanks for the contribution. Can you also provide a screenshot of the error so that everyone knows what it is about?

@bhavyamsharmaa bhavyamsharmaa force-pushed the feat/add-error-boundary branch 3 times, most recently from de60ff2 to 19ce8a5 Compare June 11, 2026 21:25
Signed-off-by: Bhavyam Sharma <positionbhavyamsharma@gmail.com>
@bhavyamsharmaa bhavyamsharmaa force-pushed the feat/add-error-boundary branch from 19ce8a5 to 7ddd053 Compare June 11, 2026 21:27
@MoeidHeidari

Copy link
Copy Markdown
Collaborator

nice @bhavyamsharmaa . By screenshot I ment just add it here in the discussion we dont need to have it in the source code. It is fine for me. Please remove it in the source code and I can merge this PR.

@bhavyamsharmaa

Copy link
Copy Markdown
Author

@MoeidHeidari done, removed the screenshot from the source code.

Screenshots do not belong in the repository assets; they were requested
to be shared in the PR discussion only.

Signed-off-by: Bhavyam Sharma <positionbhavyamsharma@gmail.com>
@bhavyamsharmaa bhavyamsharmaa force-pushed the feat/add-error-boundary branch 2 times, most recently from 9e1bff4 to 66573ca Compare June 12, 2026 18:18

@MoeidHeidari MoeidHeidari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks fine to me

@MoeidHeidari MoeidHeidari merged commit 22d2ecc into crossplane-contrib:pre-release Jun 13, 2026
3 checks passed
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.

2 participants