fix(insights): stop the pulse chart from faking a continuous shape, add honest error states

Intraday pulse rendered sparse spot readings as a smooth interpolated
curve across hours-wide gaps, implying continuous monitoring the data
never had. The chart now grids one point per bucket, breaks the area
over any missing bucket (connectNulls={false}), and discloses coverage
("based on N readings across M hours") whenever that produces a visible
break.

Four surfaces also collapsed a failed fetch into the honest empty/no-
data state instead of surfacing the error: the Today hero, the
medication efficacy tab (previously stuck on the loading skeleton
forever on error), the intraday pulse chart, and the recent-workouts
dashboard tile. All four now branch on isError and render
QueryErrorCard with a retry action; the tile's "loading…" text line is
replaced with row-shaped skeletons.
This commit is contained in:
Marc-André Bombeck committed 2026-07-17 23:50:06 +02:00
1 parent fb73c97125
commit d124a3239d
12 files changed
+176 -36

No files matched your search

+6
View File
@@ -82,6 +82,10 @@ export interface UseWorkoutsResult {
isLoading: boolean;
isEmpty: boolean;
error: Error | null;
/** True once the query has exhausted retries and settled on a failure. */
isError: boolean;
/** Re-runs the query — the retry action for a failed fetch. */
refetch: () => void;
}
export function useWorkouts(opts: UseWorkoutsOptions = {}): UseWorkoutsResult {
@@ -109,6 +113,8 @@ export function useWorkouts(opts: UseWorkoutsOptions = {}): UseWorkoutsResult {
isLoading: query.isLoading,
isEmpty,
error: query.error as Error | null,
isError: query.isError,
refetch: () => void query.refetch(),
};
}