Skip to content

fix(deployments): hide empty-state during load error (F1)#200

Merged
mastermanas805 merged 1 commit into
mainfrom
fix/deployments-empty-state-during-error-f1
Jun 6, 2026
Merged

fix(deployments): hide empty-state during load error (F1)#200
mastermanas805 merged 1 commit into
mainfrom
fix/deployments-empty-state-during-error-f1

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

Bug F1 (found by the per-tier error-state matrix, PR #199)

src/pages/DeploymentsPage.tsx: on a 429/5xx load error, the page rendered the "No deployments yet" empty-state row (deployments-empty) at the same time as the deployments-error banner.

Root cause: the catch handler sets setItems([]) (honest — nothing loaded), which makes items.length === 0 true during an error. The empty-state rendered on !loading && items.length === 0, so the create-CTA showed alongside the error banner — contradictory UX: it tells the user both "nothing here, create one" and "something went wrong."

Fix

Gate the empty-state on !err:

-{!loading && items.length === 0 && (
+{!loading && !err && items.length === 0 && (

The error banner stays the dominant signal. The genuine zero-deployments empty state (no error, zero items) is unchanged and still shows the create CTA. The deployments-no-match row is already guarded by items.length > 0, so it can't fire during an error. Mirrors the page's stated TeamPage error-banner convention (the LoadError shape comment at the top of the file).

Tests (src/pages/DeploymentsPage.test.tsx)

Added F1 guards (fail before the fix, pass after):

  • error → error banner shown AND empty-state NOT shown (failed before fix)
  • 429 → retry-hint banner, no empty row (failed before fix)
  • genuine empty (no error, zero items) → create CTA still shown (happy-path preserved)
  • error banner absent on happy-path empty

Fail-before / pass-after verified locally by temporarily reverting the !err gate: 2 new tests failed, then all 18 passed once restored.

Gate

npm run gate GREEN — tsc + build + prerender + vitest (81 files, 1147 passed / 3 skipped). Patch is 100% covered (both branches of the new !err gate exercised).

Cross-ref: bug-hunt backlog F1; bug introduced/surfaced by the error-state matrix in #199.

🤖 Generated with Claude Code

On a 429/5xx the DeploymentsPage catch handler sets items=[] (honest —
nothing loaded), so the "No deployments yet" create-CTA (deployments-empty)
rendered at the same time as the deployments-error banner: contradictory UX
that tells the user both "nothing here, create one" and "something went
wrong". Gate the empty-state on `!err` so the error banner is the sole
dominant signal during a load error. The genuine zero-deployments empty
state (no error) is unchanged and still shows the create CTA.

Found by the per-tier error-state matrix sweep (PR #199).

Tests (DeploymentsPage.test.tsx):
- error → error banner shown AND empty-state NOT shown (fails before fix)
- 429 → retry-hint banner, no empty row (fails before fix)
- genuine empty (no error, zero items) → create CTA still shown
- happy-path empty has no error banner

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 6, 2026 07:34
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
dist/assets/index-BZLn7_NF.js 0 B (-100% 🔽)
dist/assets/index-BsJUZYRr.css 6.13 KB (0%)
dist/assets/index-DEGb0Dp9.js 162.17 KB (+100% 🔺)

@mastermanas805 mastermanas805 merged commit 303b129 into main Jun 6, 2026
19 checks passed
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