[Arch] No shared data-fetching pattern; inconsistent loading/error handling #62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium | Category: Frontend
No react-query/SWR; every page reimplements fetch-load-error from scratch.
Dashboard.tsx:141-149has 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 2Fixed on branch
architecture-rework, commit4420865: addedlib/useApiResource.ts(~35-line hook, not a full query-caching library — deliberately scoped per the review's own recommendation). MigratedDashboard.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 buildall pass.