docs(backlog): mark set-state-in-effect migration as DONE
Wave 3 of the 2026-05-12 audit cleared all ~45 useEffect→fetch→ setState sites; eslint.config.mjs promoted the rule to error in the same sweep. BACKLOG's "next pass" entry was stale from before that. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -157,9 +157,9 @@ The Next 15 → 16 upgrade brought `react-hooks` v7 with React Compiler safety r
|
||||
- ✅ `react-hooks/immutability` (7 → 0) — promoted to `error`. Mutable `useMemo` value in `documents-hub.tsx` drag counter → `useRef`. `let angle` mutation in `PieChart.tsx` slice loop → `reduce`. Three "function used before declared" hits (load/loadProfile in admin/onboarding-checklist + settings/user-profile + settings/user-settings) → declared inside the calling `useEffect`.
|
||||
- ✅ `react-hooks/refs` (10 → 0) — promoted to `error`. Three `ref.current = x` writes during render moved into a layout-effect (`use-realtime-invalidation.ts`, `settings-form-card.tsx`, `inbox.tsx`). Three search-related `ref.current` reads during render rewritten to backed-by-state (`command-search.tsx`, `mobile-search-overlay.tsx`). Scan shell's `fileRef.current.files[0]` read replaced with a tracked `currentFile` state.
|
||||
- ✅ `react-hooks/incompatible-library` (13 → silenced as `off`) — purely informational ("Compiler skipped this file because of a non-Compiler-safe import"). No action needed.
|
||||
- ⚠️ `react-hooks/set-state-in-effect` (51 → still warn) — almost entirely the `useEffect → fetch → setState` data-loading pattern in admin-form components. Each call site refactors cleanly to TanStack Query (`useQuery`), but it's per-file mechanical work × ~45 files = focused half-day pass. Two hooks already migrated as templates: `use-is-mobile.ts` (→ `useSyncExternalStore`), `use-notifications.ts` (socket pushes via `queryClient.setQueryData` instead of local state).
|
||||
- ✅ `react-hooks/set-state-in-effect` (51 → 0) — promoted to `error` in eslint.config.mjs. All admin-form data-loading hits migrated to TanStack Query (`useQuery`); a small ring of justified eslint-disable comments cover canonical setState-on-subscription patterns (socket-provider, carousel, settings-form-card, etc.). New regressions block CI.
|
||||
|
||||
**Next pass: data-fetching pattern migration.** Find admin components with `const [data, setData] = useState(null); useEffect(() => { fetch(...).then(setData) }, []);` and replace with `useQuery({ queryKey, queryFn })`. Land sites: every file in `src/components/admin/*` and a handful of dialog flows (smart-archive-dialog, send-document-dialog, etc.) listed in `eslint.config.mjs`. Each is ~10 min of contained refactor; doing 5 a day for a week clears the suite. Promote `set-state-in-effect` to `error` once cleared.
|
||||
**Data-fetching pattern migration: DONE.** All `useEffect → fetch → setState` sites in admin components migrated to TanStack Query. `set-state-in-effect` is now an ESLint error, so new regressions can't land.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user