Skip to content

fix(site): stop showing 'could not load' during normal chunk streaming#90

Merged
datascry merged 1 commit into
mainfrom
fix/loading-progressive-status
May 27, 2026
Merged

fix(site): stop showing 'could not load' during normal chunk streaming#90
datascry merged 1 commit into
mainfrom
fix/loading-progressive-status

Conversation

@datascry
Copy link
Copy Markdown
Owner

on mobile it says could not load roles database for about 5 seconds until the first json loads.. that is misleading

You were right. The results-status template branched on three of four `DbStatus` values:

{#if dbStatus === "ready"}        ...
{:else if dbStatus === "loading"} LOADING ROLES…
{:else}                           COULD NOT LOAD THE JOB DATABASE.
{/if}

`dbStatus = "loading-progressive"` — the legitimate state where chunk 0 has merged and chunks 1-N are streaming in — fell through to the `{:else}` branch and surfaced the alarming "COULD NOT LOAD" copy. On mobile that branch lit up for ~5 s during every cold load while chunks streamed, with actual results visible underneath. Misleading.

Fix

Invert the branching: error gets its own explicit case, the catch-all shows the loading indicator. Same fix on the `aria-busy` attribute so assistive tech reflects the in-progress state during chunk streaming.

State Before After
"loading" (waiting on manifest + chunk 0) LOADING ROLES… ✓ LOADING ROLES… ✓
"loading-progressive" (chunks streaming) COULD NOT LOAD ✗ LOADING ROLES… ✓
"error" (real terminal failure) COULD NOT LOAD ✓ (but ambiguous with above) COULD NOT LOAD ✓ (now unambiguous)
"ready" "N ROLES · PAGE 1" ✓ "N ROLES · PAGE 1" ✓

Test plan

  • bun run typecheck clean
  • Built bundle inspected — branching is now ready / error / else with else covering both loading states
  • CI green
  • Post-deploy mobile check: open openroles.today on a phone, watch the results-status line during the first 5 seconds of cold load — should read "LOADING ROLES…" with the busy dot, never "COULD NOT LOAD"

The results-status template branched on three of four DbStatus values:

  {#if dbStatus === "ready"}        ...
  {:else if dbStatus === "loading"} LOADING ROLES…
  {:else}                           COULD NOT LOAD THE JOB DATABASE.
  {/if}

dbStatus = "loading-progressive" — the legitimate state where chunk 0
has merged and chunks 1-N are streaming in — fell through to the
`:else` branch and surfaced the alarming "COULD NOT LOAD" copy. On
mobile that branch lit up for ~5 s during every cold load while
chunks streamed, with actual results visible underneath. Misleading.

Invert the branching: error gets its own explicit case, the catch-all
shows the loading indicator. Same fix at the aria-busy attribute so
assistive tech reflects the in-progress state during chunk streaming.

Before:
  loading              → LOADING ROLES…   (correct)
  loading-progressive  → COULD NOT LOAD   (WRONG — looked like an error)
  error                → COULD NOT LOAD   (correct, but ambiguous)
  ready                → "N ROLES · PAGE 1" (correct)

After:
  loading              → LOADING ROLES…   (correct)
  loading-progressive  → LOADING ROLES…   (correct, was the bug)
  error                → COULD NOT LOAD   (correct, now unambiguous)
  ready                → "N ROLES · PAGE 1" (correct)
@datascry datascry merged commit a923d43 into main May 27, 2026
10 checks passed
@datascry datascry deleted the fix/loading-progressive-status branch May 27, 2026 22:00
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