Skip to content

Fix/list fetch error toast - #8

Merged
ghostcoder42 merged 3 commits into
mainfrom
fix/list-fetch-error-toast
Sep 3, 2026
Merged

ghostcoder42 merged 3 commits into
mainfrom
fix/list-fetch-error-toast

Conversation

@ghostcoder42

Copy link
Copy Markdown
Owner

A failed page fetch (e.g. a transient 502 while paging the home feed) sent the whole screen to 'Error loading videos', throwing away pages that were already loaded and rendered.

List screens now keep their content when a fetch fails with something on screen and surface a small centered toast instead; the full error screen remains only when there is nothing to keep. The toast message is classified per failure (fetchPage attaches the HTTP status): offline, timeout, rate-limited (429), server trouble with status (e.g. 'The site is having trouble (502)…'), removed content (404/410), and other HTTP errors — all localized in the seven app languages. Applied to home, search (which previously failed silently), tag, category, model and author screens.

Also drops the stale '@shopify/flash-list/jestSetup' import from the test utils: it mocks FlashList to a v1-only export that no longer exists in flash-list 2.x (undefined), which made rendering FlashList in tests crash.

The setup module mocks FlashList to RecyclerView — an export that only
exists in flash-list v1. Under the repo's flash-list 2.x it registers
the mock as undefined, so any test that actually renders FlashList
crashes in nativewind's JSX runtime. Nothing rendered it so far, which
is why it went unnoticed.
New fetch-error module maps a failed site fetch to a kind and shows a
small centered toast with a localized, cause-specific message.
fetchPage attaches the HTTP status to its errors, so HTTP responses
classify precisely (429 rate-limited, 404/410 removed content, >=500
server trouble, other 4xx request failure — server/http messages carry
the status code, e.g. 'The site is having trouble (502)…'), while
errors without a status split into timeout ('Request timed out') and
offline. Messages added to all seven app languages.
A failed page fetch (e.g. a transient 502 while paging the home feed)
sent the whole screen to 'Error loading videos', discarding pages
that were already loaded and rendered.

List screens now keep their content when a fetch fails with something
on screen and surface the classified toast instead; the full error
screen remains only when there is nothing to keep. Wired into home,
search (which previously failed silently), tag, category, model and
author screens via a small useFetchErrorToast hook.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

💯 Test Coverage

Lines Statements Branches Functions
Coverage: 53%
53.56% (856/1598) 45.67% (438/959) 44.59% (227/509)

😎 Tests Results

Tests Skipped Failures Errors Time
274 0 💤 0 ❌ 0 🔥 18.02s ⏱️
👀 Tests Details • (53%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files53.5645.6744.5953.92 
src/app/(app)5.153.494.345.3 
   index.tsx81.255071.428052, 81–82
   search.tsx000017–188
src/app/author0000 
   [id].tsx000016–105
src/app/category0000 
   [name].tsx000015–65
src/app/model0000 
   [slug].tsx000015–98
src/app/tag0000 
   [id].tsx000016–100
src/lib77.5541.6673.3379.06 
   test-utils.tsx100100100100 
src/lib/hooks49.3531.8167.5648.17 
   use-fetch-error-toast.ts100100100100 
src/lib/r3485.2479.577585.71 
   fetch-error.ts100100100100 

@ghostcoder42
ghostcoder42 merged commit 0e0063b into main Sep 3, 2026
1 check passed
@ghostcoder42
ghostcoder42 deleted the fix/list-fetch-error-toast branch September 3, 2026 06:47
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.

1 participant