fix(client): silence react-hooks/incompatible-library on AgentSettingsTab#129
Merged
jackmusick merged 2 commits intomainfrom Apr 27, 2026
Merged
fix(client): silence react-hooks/incompatible-library on AgentSettingsTab#129jackmusick merged 2 commits intomainfrom
jackmusick merged 2 commits intomainfrom
Conversation
…sTab
Replace `form.watch(name)` calls with `useWatch({ control, name })` so the
React Compiler can memoize the component. `watch()` returns a function
reference that cannot be safely memoized (react-hooks 7.1's
`incompatible-library` rule).
Also align the deps of two `useMemo` calls with what React Compiler infers
(`toolsGrouped` instead of `toolsGrouped?.workflow`) to keep manual
memoization preservable. Behaviorally a no-op since `toolsGrouped`
identity changes only when `workflow` does in the calling code paths.
Rule categories addressed:
- react-hooks/incompatible-library (4 sites in AgentSettingsTab)
- react-hooks/preserve-manual-memoization (3 sites in AgentSettingsTab)
Verification: `npm run lint` reports 0 errors and 1 warning (down from
2). `npm run tsc` clean. Vitest 766/766 passing.
Deferred — `client/src/components/forms/FormRenderer.tsx:598` still
emits one `react-hooks/incompatible-library` warning for the bare
`watch()` snapshot. Fixing it (substituting `useWatch({ control })`)
unblocks the React Compiler, which then surfaces 5 pre-existing latent
bugs in that file (`react-hooks/refs` × 4, `react-hooks/set-state-in-effect`
× 1) — the data-provider/auto-fill ref-bridge architecture writes refs
during render and reads them from effect deps. Resolving those needs
the broader sweep tracked in #74; tackling it here would exceed the
30-min budget for this small fix and risk behavioral regressions.
Refs #74
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Partial progress on #74. Replaces 4 `form.watch(name)` calls in `AgentSettingsTab.tsx` with `useWatch({ control: form.control, name })` to satisfy `react-hooks/incompatible-library`. Also aligns 3 `useMemo` deps from `toolsGrouped?.workflow` to `toolsGrouped` so the React Compiler's inferred deps match the manual ones (`react-hooks/preserve-manual-memoization`).
Lint: 2 warnings → 1.
Deferred
The remaining warning is on `FormRenderer.tsx:598` (`const formValues = watch();`). Applying the same substitution here is mechanically possible, but it unblocks the React Compiler which then surfaces 5 pre-existing latent issues in the same file (set-state-in-effect, ref deps, ref writes during render). Those need a real refactor of the form's data-provider auto-fill ref-bridge — too risky for this PR. Tracked in #74 (which stays open for that follow-up).
Test plan
🤖 Generated with Claude Code