Skip to content

refac: make admin network errors recoverable when cached data exists#9526

Open
djbarnwal wants to merge 1 commit into
mainfrom
refac/network-issue-admin-query
Open

refac: make admin network errors recoverable when cached data exists#9526
djbarnwal wants to merge 1 commit into
mainfrom
refac/network-issue-admin-query

Conversation

@djbarnwal
Copy link
Copy Markdown
Member

@djbarnwal djbarnwal commented Jun 5, 2026

Returning to an already-open dashboard tab frequently shows a full-page “Network Error” instead of either preserving the last view or retrying the load.

Root cause: any admin API query failing with Axios’ Network Error was treated as a global fatal error. This could happen from background or peripheral admin queries, even when the dashboard already had usable cached data. Once set, the global error page only cleared on navigation, so the tab could remain stuck on the network error.

This change:

  • Keeps the current page visible when an admin API Network Error occurs but the query already has cached data
  • Shows a recoverable warning banner with a retry action instead of replacing the app with the full-page Network Error
  • Keeps the full-page Network Error for true initial-load failures with no cached data
  • Clears the network error state after a successful admin query
  • Refetches active admin queries on browser online, focus, and tab visibility recovery
  • Adds limited retry/backoff for transient Network Error query failures
  • Adds unit coverage for cached-data, initial-load, recovery, and non-admin query behavior

@djbarnwal djbarnwal requested a review from AdityaHegde June 5, 2026 09:35
let adminNetworkErrorActive = false;

export function isNetworkError(error: unknown): boolean {
return error instanceof Error && error.message === AdminNetworkErrorMessage;
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.

Does this handle all cases? Check web-common/src/lib/errors.ts for some additional types of errors.

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