Skip to content

fix(hooks): clear last react-hooks warnings + promote 5 rules to error (#38 batch 3/3, closes #38) - #90

Merged
tbcsec merged 1 commit into
mainfrom
fix/react-hooks-batch3-refs-and-promote
Jul 27, 2026
Merged

fix(hooks): clear last react-hooks warnings + promote 5 rules to error (#38 batch 3/3, closes #38)#90
tbcsec merged 1 commit into
mainfrom
fix/react-hooks-batch3-refs-and-promote

Conversation

@tbcsec

@tbcsec tbcsec commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Final batch for #38 — takes the react-hooks warning count to zero and promotes the five React-Compiler-era rules from warn to error so regressions are a CI failure.

Fixes:

  • admin/appearance (react-hooks/refs, ×2): the restore-theme-on-leave cleanup needs the latest saved settings + palette override but must fire only on unmount, so they were mirrored into refs during render. Now mirrored from an effect (refs belong outside render); the mount-only cleanup reads them unchanged — behaviour identical.
  • route-progress (immutability + preserve-manual-memoization, and a stray exhaustive-deps disable): finish was declared after start and referenced before declaration behind a lint-disable. Reordered it above start as a proper dependency, which clears both warnings and removes two eslint-disable comments. The route-commit effect now finishes on the next animation frame instead of synchronously — a genuine react-to-external-event (the router committed), and deferring keeps the 100%→fade paint from being coalesced into the route's own render.

Endgame: the five rules (refs, set-state-in-effect, static-components, immutability, preserve-manual-memoization) are now error, set explicitly so the CI gate is unambiguous; the burn-down comment block is gone.

Verification — live on the demo stack:

  • Appearance: previewed the Sandstone palette (whole surface recoloured live), navigated away without saving → unmount cleanup restored the saved Harbor palette. Exactly the latest-ref behaviour, now sourced from an effect.
  • Route progress: clicked an internal link to a heavier route → the top bar appeared mid-navigation and hid once the route committed. No console errors.
  • tsc clean · eslint 0 problems (rules at error) · vitest 130/130.

Sequenced after #88 and #89. With this, #38 is fully resolved.

🤖 Generated with Claude Code

…to error (#38 batch 3/3)

Closes out the #38 burn-down (28 warnings -> 0):

- admin/appearance: the restore-theme-on-leave cleanup needs the latest saved
  settings + palette override but must run only on unmount, so those were
  mirrored into refs *during render* (react-hooks/refs). Now mirrored from an
  effect (refs belong outside render); unmount cleanup reads them unchanged.
- route-progress: reordered "finish" above "start" so it's a real dependency
  instead of used-before-declaration behind a lint-disable — clearing the
  immutability + preserve-manual-memoization warnings and dropping two
  eslint-disable comments. The route-commit effect now finishes on the next
  animation frame rather than synchronously (a genuine react-to-external-event;
  deferring also keeps the 100%-then-fade paint out of the route's own render).

With the count at zero, the five React-Compiler-era rules (refs,
set-state-in-effect, static-components, immutability,
preserve-manual-memoization) are promoted from warn to error - explicit, so
CI blocks any regression and the codebase stays React-Compiler-ready.

Verified live: appearance palette preview applies and, on leaving unsaved,
restores the saved palette (Sandstone preview -> Harbor on nav-away); the route
progress bar shows during navigation and hides on commit. tsc clean, eslint 0
problems, vitest 130/130.

Co-Authored-By: Claude <noreply@anthropic.com>
@tbcsec
tbcsec merged commit 65f5cd1 into main Jul 27, 2026
4 checks passed
@tbcsec
tbcsec deleted the fix/react-hooks-batch3-refs-and-promote branch July 27, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant