fix(hq-web): Employees page no longer shows a permanent Loading state on fetch failure

employees stays undefined when getEmployees rejects, so the page rendered
the error Notice AND an eternal "Loading…" EmptyState below it. Branch on
list.error first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat/client-detail-redesign
Thomas Joise 5 days ago
parent 56b00b60c6
commit 0be928fbf8

@ -61,7 +61,10 @@ export function Employees() {
)}
{error !== undefined && <Notice tone="err">{error}</Notice>}
{list.error !== undefined && <Notice tone="err">{list.error}</Notice>}
{employees === undefined ? <EmptyState>Loading</EmptyState>
{/* Branch on the fetch error first `employees` stays undefined on failure,
so falling through would show "Loading…" forever under the error notice. */}
{list.error !== undefined ? null
: employees === undefined ? <EmptyState>Loading</EmptyState>
: employees.length === 0 ? <EmptyState>No employees yet.</EmptyState> : (
<>
<DataTable

Loading…
Cancel
Save