diff --git a/Docs/Tasks.md b/Docs/Tasks.md index 4e617c8..5ca06d5 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -1,22 +1,3 @@ -### TASK-QUALITY-04 — `pendingSaveRef as boolean` Redundant Cast in `useAutoSave` - -**Where found** -`frontend/src/hooks/useAutoSave.ts`. The code contains `if (pendingSaveRef.current as boolean)` where `pendingSaveRef` is already typed as `React.MutableRefObject`. The `as boolean` cast is redundant and suggests the author was uncertain about the type. - -**Goal** -Remove the cast: `if (pendingSaveRef.current)`. Run TypeScript type-check to confirm no error is introduced. - -**Possible traps and issues** -- None. This is a one-line cleanup. - -**Docs changes needed** -None required. - -**Why this is needed** -Redundant type assertions are noise that makes reviewers second-guess the type system. They also suppress TypeScript errors in cases where the cast is actually incorrect. - ---- - ### TASK-QUALITY-05 — `console.warn` in `MapPage` Provides No User Feedback for Threshold Errors **Where found** diff --git a/frontend/src/pages/MapPage.tsx b/frontend/src/pages/MapPage.tsx index 997d23a..a14b1ce 100644 --- a/frontend/src/pages/MapPage.tsx +++ b/frontend/src/pages/MapPage.tsx @@ -10,6 +10,7 @@ import { useState, useMemo, useEffect } from "react"; import { Button, MessageBar, + MessageBarActions, MessageBarBody, Spinner, Text, @@ -142,12 +143,7 @@ export function MapPage(): React.JSX.Element { const thresholdMedium = mapThresholds?.threshold_medium ?? 50; const thresholdHigh = mapThresholds?.threshold_high ?? 100; - useEffect(() => { - if (mapThresholdError) { - // Silently fall back to defaults if fetch fails - console.warn("Failed to load map color thresholds:", mapThresholdError); - } - }, [mapThresholdError]); + const [dismissedThresholdWarning, setDismissedThresholdWarning] = useState(false); useEffect(() => { setPage(1); @@ -223,6 +219,24 @@ export function MapPage(): React.JSX.Element { )} + {mapThresholdError && !dismissedThresholdWarning && ( + + + Map color thresholds could not be loaded. Using default thresholds. + + +