[Arch] No shared data-fetching pattern; inconsistent loading/error handling #62

Closed
opened 2026-07-01 07:27:06 +02:00 by bullitt · 1 comment
Owner

Severity: Medium | Category: Frontend

No react-query/SWR; every page reimplements fetch-load-error from scratch. Dashboard.tsx:141-149 has no loading state and no error handling at all for its main fetch.

Recommendation: Add a small shared useApiResource<T>(fetcher) hook returning {data, loading, error, refetch}; migrate pages incrementally. Do not add react-query preemptively — revisit only if cross-page caching becomes a real need.

Full detail: docs/architecture-review.md § C + § G + § F Phase 2

**Severity:** Medium | **Category:** Frontend No react-query/SWR; every page reimplements fetch-load-error from scratch. `Dashboard.tsx:141-149` has no loading state and no error handling at all for its main fetch. **Recommendation:** Add a small shared `useApiResource<T>(fetcher)` hook returning `{data, loading, error, refetch}`; migrate pages incrementally. Do not add react-query preemptively — revisit only if cross-page caching becomes a real need. Full detail: `docs/architecture-review.md` § C + § G + § F Phase 2
Author
Owner

Fixed on branch architecture-rework, commit 4420865: added lib/useApiResource.ts (~35-line hook, not a full query-caching library — deliberately scoped per the review's own recommendation). Migrated Dashboard.tsx's main shipment fetch to it, which previously had no loading state and no error handling at all — a failed request failed silently with an empty list. Now shows a loading indicator and a dismissible error banner with Retry. Verified: tsc, eslint, knip, vite build all pass.

Fixed on branch `architecture-rework`, commit 4420865: added `lib/useApiResource.ts` (~35-line hook, not a full query-caching library — deliberately scoped per the review's own recommendation). Migrated `Dashboard.tsx`'s main shipment fetch to it, which previously had no loading state and no error handling at all — a failed request failed silently with an empty list. Now shows a loading indicator and a dismissible error banner with Retry. Verified: `tsc`, `eslint`, `knip`, `vite build` all pass.
Sign in to join this conversation.
No labels
arch
harness
security
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bullitt/trackbox#62
No description provided.