fix(web): improve frontend error handling#1498
Merged
Haz3-jolt merged 1 commit intoJun 23, 2026
Merged
Conversation
4b70b9b to
11ebec8
Compare
- Add React ErrorBoundary at app root (prevents white-screen crashes) - Auth guard: don't clear session on network errors (TypeError/offline) - Token refresh: only nuke session when online (not on transient failures) - Exec dashboard tabs: show error state instead of fake zeroes - Cost baselines: toast on save failure - Audit log export: toast on failure - Admin settings: toast when toggle state fails to load - Leaderboard: error state when queries fail - Registry home: surface error text on session load failure - API client: sanitize raw error messages (tracebacks, long text) - Insights HTML export: retry with fresh token on 401 - useDeploymentConfig: expose configError for consumers
11ebec8 to
b5feba6
Compare
Haz3-jolt
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose / Description
Fixes the reported issue where the frontend incorrectly clears the user's session and redirects to login when the API is temporarily unreachable (network drop, server restart, flaky connection). Also adds a global error boundary and improves error feedback across multiple pages.
Fixes
Approach
Core fix:
_tryRefreshTokennow returns"ok" | "rejected" | "network_error"instead of a boolean. The auth guard and request wrapper only clear the session on"rejected"(server explicitly said no), not on"network_error"(fetch threw TypeError because server was unreachable).Error boundary: Class component wrapping the app root. Catches render errors and shows "Something went wrong - Reload" instead of white-screening.
Error states on data pages: Exec dashboard tabs, leaderboard, registry home now check
isErrorfrom React Query and show error messages instead of rendering with undefined data (which produced misleading zeroes).Silent failures surfaced: Cost baselines save, audit log export, and admin settings load all now show toasts on failure.
API client hardening: Raw error messages (tracebacks, long plaintext) are sanitized before reaching toasts. Insights HTML export now retries with a fresh token on 401.
How Has This Been Tested?
Checklist
AI Assistance