S1: usePlot bypasses exhaustive-deps — fragile closure contract #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code Smell
File:
web/components/ChartCard/usePlot.ts:71The entire
build()deps array is handed off to parent via thedeps: DependencyListparameter. Therebuildcallback wrapsdepswith aneslint-disable-next-line react-x/exhaustive-depscomment. If parent omits a dependency, stale closure bugs can occur (wrongrows, oldcolorMap).Code reference
Why it matters
Bypassing exhaustive-deps removes all compile-time safety. Parent must manually keep deps in sync.
Suggestion
Document the contract explicitly in the JSDoc, or restructure
usePlotto use refs for stable closures and trigger rebuild via a separate mechanism.