Skip to content

fix(network): preserve cached data on transient network errors - #336

Open
tkhorik wants to merge 1 commit into
friendly-social:devfrom
tkhorik:fix/network-error-on-inactivity
Open

fix(network): preserve cached data on transient network errors#336
tkhorik wants to merge 1 commit into
friendly-social:devfrom
tkhorik:fix/network-error-on-inactivity

Conversation

@tkhorik

@tkhorik tkhorik commented Aug 8, 2026

Copy link
Copy Markdown

queryFn resolved a Result instead of rejecting, so React Query treated network failures as successful fetches — no retries, and cached data got overwritten with the error. This caused the "Network Error" screen on every app resume from background.

  • unwrap() throws on a failed Result instead of returning it as data
  • queries only show the error screen when there's no cached data yet
  • retry only on transient network errors, not 401/status
  • add axios timeout so hung requests fail fast enough to retry

Fixes #263

queryFn resolved a Result instead of rejecting, so React Query
treated network failures as successful fetches — no retries, and
cached data got overwritten with the error. This caused the
"Network Error" screen on every app resume from background.

- unwrap() throws on a failed Result instead of returning it as data
- queries only show the error screen when there's no cached data yet
- retry only on transient network errors, not 401/status
- add axios timeout so hung requests fail fast enough to retry

Fixes friendly-social#263
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.

Fix Network Error on inactivity

1 participant