Web lint warnings reduced from 20 → 15 by fixing the categories that flag real architectural smells rather than the canonical fetch-on-mount setState pattern. Real fixes: 1. web/src/lib/use-theme.ts — replace useEffect + setState mount-sync pattern with React.useSyncExternalStore. The hook now subscribes to browser storage events, returns a stable snapshot for SSR, and uses a manual storage-event dispatch so same-document setters refresh correctly. Eliminates the cascading-render advisory and gains free cross-tab theme sync. 2. web/src/lib/use-keyboard-shortcuts.ts — move ref assignment from render time into a useEffect. Fixes the 'Cannot access refs during render' advisory without behavior change. 3. web/src/components/NoteEditor.tsx — move onSaveRef.current = onSave from render time into a useEffect for the same reason. 4. web/src/app/(app)/reviews/page.tsx — wrap handleDecision and handleBatchDecision in useCallback so the useEffect that depends on them no longer re-subscribes the keydown listener on every render. Fixes both react-hooks/exhaustive-deps warnings and the underlying perf bug they pointed at. 5. web/src/app/(app)/prompts/page.tsx — wrap loadTemplates in useCallback declared before the useEffect that calls it. Fixes the 'Cannot access variable before it is declared' advisory. Remaining 15 warnings are React-compiler runtime hints about fetchData().then(setData) patterns inside useEffect, which is the canonical fetch-on-mount pattern shown in React's own docs. Resolving them properly requires Suspense + use() or risky startTransition wraps; both are out of scope and tracked under future tech debt. Verified: - pnpm --filter @notelett/web run typecheck: passes - pnpm --filter @notelett/web run lint: 0 errors, 15 warnings (down 5) - pnpm run verify: backend 380/380, web 96/96, mobile 97/97 |
||
|---|---|---|
| .. | ||
| e2e | ||
| public | ||
| scripts | ||
| src | ||
| test-results | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile | ||
| eslint.config.mjs | ||
| next-env.d.ts | ||
| next.config.ts | ||
| package.json | ||
| playwright.config.ts | ||
| tsconfig.json | ||
| vitest.config.ts | ||