Fetchers in app/api/api_calls.ts wrap results in { status, data } objects that every hook in app/query/hooks.ts must translate back into TanStack Query state. An incomplete translation led to a crash crash (see #4097) where a
failed fetch resolved a query as success with null data. The hooks now throw on anything other than Success and the legitimate empty states, but the translation step itself should go.
- Fetchers throw on failure and return plain data on success, so hooks become
queryFn: fetchTeamsFromServer with no status mapping.
- Legitimate empty states (
NoApps, NoData, NotOnboarded, NoBuilds) stay
representable as return values, for example a discriminated union.
- Components tracking
Init/Loading enum members migrate to TanStack's own
statuses, then the *ApiStatus enums get deleted.
Touches app/api/api_calls.ts, app/query/hooks.ts, app/stores/filters_store.ts, and components that use status enums for UI state. Done when failures always travel as exceptions, no *ApiStatus enums
remain, and the unit and MSW integration suites pass.
Fetchers in
app/api/api_calls.tswrap results in{ status, data }objects that every hook inapp/query/hooks.tsmust translate back into TanStack Query state. An incomplete translation led to a crash crash (see #4097) where afailed fetch resolved a query as success with null data. The hooks now throw on anything other than
Successand the legitimate empty states, but the translation step itself should go.queryFn: fetchTeamsFromServerwith no status mapping.NoApps,NoData,NotOnboarded,NoBuilds) stayrepresentable as return values, for example a discriminated union.
Init/Loadingenum members migrate to TanStack's ownstatuses, then the
*ApiStatusenums get deleted.Touches
app/api/api_calls.ts,app/query/hooks.ts,app/stores/filters_store.ts, and components that use status enums for UI state. Done when failures always travel as exceptions, no*ApiStatusenumsremain, and the unit and MSW integration suites pass.