Every keystroke fetched the activity feed. The dependency looked harmless
Typing 10 characters into a comment box sent 10 activity requests. Genie's effect audit named the inline array behind it, and verify proved the fix.
Typing "Looks good" into an issue's comment box sent 10 requests to /api/issues/CORE-12/activity, one per key. The cause was one prop, types={['created', 'status', 'field']}. The useActivity effect lists types as a dependency, so each keystroke re-rendered the page, built a new array, and fetched the feed again.
This walkthrough runs against apps/realworld-legacy, a React 18 app in this repo with webpack and Redux. Every command and output below comes from runs on 2026-11-19. The raw evidence has the full output.
Ten keys sent ten requests
Start a timeline recording, type into the comment box with agent-browser, and read the request lane:
npx genie-react call react_clear_renders '{}' --session upd-d
npx genie-react call timeline_start '{"name":"type a comment"}' --session upd-d --json
agent-browser --session upd-d click 'textarea[aria-label="Add a comment"]'
agent-browser --session upd-d keyboard type 'Looks good'
npx genie-react call react_quiesce '{"idleMs":500,"timeoutMs":10000}' --fail-on-result-error --session upd-d
npx genie-react call timeline_stop '{"id":"timeline-d3cbc466-4ded-49db-84c2-1075810ad900"}' --session upd-d
npx genie-react call timeline_read '{"id":"timeline-d3cbc466-4ded-49db-84c2-1075810ad900","domains":["request"]}' --session upd-d --fields atMs,detailsTrimmed to the shared fields, the first two rows and the last:
[10]:
each: {details:{url:http://127.0.0.1:5234/api/issues/CORE-12/activity,query:"?types=~166ad13156",…,method:GET,outcome:response,overlappingSameEndpoint:9,finishedAfterNewer:false}}
- {atMs:115.9,details:{startMs:53.2,endMs:115.1,durationMs:61.9,bodyReadMs:115.6,bodyReadLast:false}}
- {atMs:176.2,details:{startMs:58.1,endMs:175.9,durationMs:117.8,bodyReadMs:176.2,bodyReadLast:false}}
…
- {atMs:669.4,details:{startMs:88.8,endMs:668.4,durationMs:579.6,bodyReadMs:669.2,bodyReadLast:true}}Ten characters, ten GET requests, all started within 36 ms. Every one carries the same hashed types value, so the app asked for identical data ten times.
The effect audit names the dependency
The timeline shows what left the page, not which code sent it. react_effect_audit reads the effects of one component inside the same render window:
npx genie-react call react_effect_audit '{"component":"ActivityLog"}' --session upd-dTrimmed to the one effect it found:
effects:[{index:0,hookIndex:1,kind:effect,depsMode:list,depCount:2,scheduled:10,fired:10,updates:11,lastChangedDep:1,cleanupFunctionObserved:true,hasCleanup:true,
note:"re-ran 10 times when no dependency changed value — dependency [1] is a new reference with equal contents; trace its producer and stabilize it or depend on its primitive fields",
hotness:{label:hot,basis:reference-only-reruns,reruns:{valueChanged:0,referenceOnly:10,undetermined:0},…,scheduleReason:below-schedule-rate,…},
hook:useEffect,customHooks:[useActivity],source:{file:/src/features/issue-detail/use-activity.ts,line:13,column:1,functionName:useActivity,sourceMapConfidence:mapped,role:hook-callsite},…}]The effect ran 10 times. Dependency [1] changed reference every time and changed value zero times. basis:reference-only-reruns is why the label is hot. scheduleReason says below-schedule-rate because the effect was scheduled on 10 of 11 updates, and that rate decides the label only for an effect without a dependency array.
source points at the useEffect on line 13 of use-activity.ts, read through the module's source map (sourceMapConfidence:mapped). The column is 1 because this app's webpack config uses eval-cheap-module-source-map, which maps lines only. Genie 1.0.2 reported line 15, a line in the transformed module, and 1.1.0 fixed it. The audit's component source points at the JSX call site, issue-detail-page.tsx:56.
react_effect_timeline lists each run with the slot that changed:
npx genie-react call react_effect_timeline '{"component":"ActivityLog","limit":3}' --session upd-devents[3]:
each: {…,phase:update,event:scheduled,evidence:exact,dependencyComparison:compared,changedDependencySlots:[1],dependencyChanges:[{slot:1,change:reference-only}],…,execution:{status:observed,evidence:exact,outcome:completed,trigger:commit},…}
- {effectEventId:effect:32:951,…,cleanupExecution:{status:unobserved,reason:not-yet-observed},…}
- {effectEventId:effect:31:850,…,cleanupExecution:{status:observed,evidence:exact,…,outcome:completed},…}
- {effectEventId:effect:30:749,…,cleanupExecution:{status:observed,evidence:exact,…,outcome:completed},…}The cleanup ran before each new run, so the effect is not leaking. It is doing the same work again for no reason.
A new array on every render re-runs the effect
Here is the hook:
useEffect(() => {
let cancelled = false
request<ActivityEvent[]>(
`/api/issues/${issueKey}/activity${toQueryString({ types: types.join(',') })}`,
)
// …
}, [issueKey, types])And here is the parent:
const [commentDraft, setCommentDraft] = useState('')
// …
<ActivityLog issueKey={issue.key} types={['created', 'status', 'field']} />The comment draft lives in IssueDetailPage. Each keystroke calls setCommentDraft, IssueDetailPage renders again, and the JSX builds a fresh array literal. React compares dependencies with Object.is, so the new array counts as a change and the effect re-runs.
The hooks lint rule does not catch this. oxlint 1.87.0's port of react-hooks/exhaustive-deps reported a missing dependency in a test file, then passed all three app files with exit 0. The dependency list is complete. The rule checks the hook, and the hook cannot know that its caller builds types fresh on every render.
Hoist the array out of render
Move the array out of render so it keeps one identity:
import IssueTitleEditor from './issue-title-editor'
+const ACTIVITY_TYPES = ['created', 'status', 'field']
+
export function IssueDetailPage() {
@@
- <ActivityLog issueKey={issue.key} types={['created', 'status', 'field']} />
+ <ActivityLog issueKey={issue.key} types={ACTIVITY_TYPES} />Verify proves the effect stopped
Declare what typing must do before you change code. The effect must not run at all, CommentComposer must render (so a run that never reached the textarea fails), and no error boundary may catch:
npx genie-react verify begin --session upd-d --name 'type a comment' \
--claim 'effect ActivityLog max 0' --claim 'render CommentComposer min 1' --claim 'boundaries clean'
agent-browser --session upd-d click 'textarea[aria-label="Add a comment"]'
agent-browser --session upd-d keyboard type 'Looks good'
npx genie-react verify end vfy_fedc05c9-9e0d-424f-99fe-4a25ba78d583 --session upd-dOn the shipped code, trimmed to the verdict and claim lines, it exits 1:
fail vfy_fedc05c9-9e0d-424f-99fe-4a25ba78d583 "type a comment" 13 commits, quiet after 944 ms (react)
1 fail effect ActivityLog max 0 {effects:[{effectIndex:0,runs:10,rawRuns:10}]}
2 pass render CommentComposer min 1 {renders:10,mounts:0,updates:10,remounts:0,semantics:exact,instances:1,activeInstances:1}
3 pass boundaries clean {caughtDuringWindow:0,caughtAtEnd:0}With the fix applied and the page reloaded, the same claims and the same typing exit 0:
pass vfy_ed61c8c6-4df8-40e6-b64a-ed6fbf38af8b "type a comment" 12 commits, quiet after 796 ms (react)
1 pass effect ActivityLog max 0 {effects:[]}
2 pass render CommentComposer min 1 {renders:10,mounts:0,updates:10,remounts:0,semantics:exact,instances:1,activeInstances:1}
3 pass boundaries clean {caughtDuringWindow:0,caughtAtEnd:0}
attempt 2 for these claims on this tab; previous fail vfy_fedc05c9-9e0d-424f-99fe-4a25ba78d583; document reloaded sinceCommentComposer still rendered 10 times, once per key, which is what a controlled textarea should do. The effect ran 0 times. A second timeline recording of the same typing on the fixed code returned matchedEventCount: 0 for the request lane, so the 10 requests are gone.
When this approach does not fit
- The effect tools see effects in React components. A request sent from an event handler, a class lifecycle method or a Redux thunk never shows up in
react_effect_audit. Use the timeline request lane for those, and read the code that sends them. - An effect with dependencies is
hotonly after it re-runs at least 3 times in the window (hotnessCriteria.minUpdates:3). If you type one character, readfiredandlastChangedDepinstead of the label. - A constant only works when the array never changes. If the types come from props or state, wrap the array in
useMemo, or passtypes.join(',')and depend on the string. This walkthrough did not test those variants.
Debug renders and effects covers the effect tools, and Verify a fix lists every claim form.
useSelector returned a new object, so the avatar menu re-rendered on every action
Typing five letters in the issue filter re-rendered the avatar menu nine times with identical data. Genie tied the render to the Redux action, and verify proved a two-line fix.
Is it the network or React? Find what made one click slow
A Genie timeline split one click into a 63 ms request and an 8.4 ms render of a 100-row table that had not changed. Read both lanes, fix the render, and prove it.