Problem
eslint-plugin-react-hooks was bumped from 7.0.1 → 7.1.1 in package-lock.json during the airdrop PR batch. Version 7.1.1 introduces a new react-hooks/set-state-in-effect rule that flags setState() calls directly inside useEffect bodies. This breaks CI for 3 components that previously passed.
Root Cause
The lockfile update happened during npm install @openzeppelin/merkle-tree (PR #893). The semver range ^7.0.0 resolved to 7.1.1 which includes the stricter rule.
Affected Files
| File |
Line |
Issue |
src/components/RatingWidget.tsx |
77 |
setSelectedRating() inside useEffect |
src/components/AgentManage.tsx |
129 |
setEditName() etc. inside useEffect |
src/hooks/useDraft.ts |
43 |
setRestored() inside useEffect |
src/components/ReadingMode.tsx |
22 |
Unused storylineId variable (warning, not error) |
Fix
Already applied in PR #917 (hotfix branch task/913-fix-metadata-type):
- RatingWidget: Replaced setState-in-effect with ref comparison pattern (compare
prevMyRatingRef to detect changes during render)
- AgentManage: Wrapped metadata field population in
queueMicrotask()
- useDraft: Wrapped
setRestored(true) in queueMicrotask()
- ReadingMode: Added eslint-disable comment for unused destructured prop
Note
This ticket is tracked for record-keeping. The fix is already included in PR #917. No additional work needed unless PR #917's approach needs revision.
References
Problem
eslint-plugin-react-hookswas bumped from 7.0.1 → 7.1.1 inpackage-lock.jsonduring the airdrop PR batch. Version 7.1.1 introduces a newreact-hooks/set-state-in-effectrule that flagssetState()calls directly insideuseEffectbodies. This breaks CI for 3 components that previously passed.Root Cause
The lockfile update happened during
npm install @openzeppelin/merkle-tree(PR #893). The semver range^7.0.0resolved to7.1.1which includes the stricter rule.Affected Files
src/components/RatingWidget.tsxsetSelectedRating()inside useEffectsrc/components/AgentManage.tsxsetEditName()etc. inside useEffectsrc/hooks/useDraft.tssetRestored()inside useEffectsrc/components/ReadingMode.tsxstorylineIdvariable (warning, not error)Fix
Already applied in PR #917 (hotfix branch
task/913-fix-metadata-type):prevMyRatingRefto detect changes during render)queueMicrotask()setRestored(true)inqueueMicrotask()Note
This ticket is tracked for record-keeping. The fix is already included in PR #917. No additional work needed unless PR #917's approach needs revision.
References
eslint-plugin-react-hookschangelog:set-state-in-effectrule added in 7.1.x