Genie React

Select one row and all 100 redraw: the inline arrow that breaks PureComponent

Genie counted 100 IssueRow renders for one checkbox click, named the new onToggle arrow as the cause, and verified the fix at one render.

Ticking one checkbox in a 100-row issue table re-rendered all 100 IssueRow components. IssueTable passes each row a new onToggle arrow on every render, so the row's PureComponent shallow prop check always fails. After the fix, the same click rendered one row, and genie-react verify went from fail (exit 1) to pass (exit 0).

Every command below ran on 2026-11-19 with Genie 1.1.0 against apps/realworld-legacy in this repository, a React 18.3 app with webpack, Redux and connect() class components. The full log is in the evidence file. Output blocks are trimmed to the fields shown, and long source paths are cut to …/src/.

The symptom

The answer key for this seeded bug reports it the way a user would.

Ticking one checkbox in the issue table lags. It looks like every row on the page redraws.

The /issues page shows 100 rows. The browser driver is agent-browser, with the session name upd-c.

Count the rows that rendered

Open a render window for IssueRow, click one checkbox, wait for React to go idle, then ask which rows updated:

npx genie-react call react_clear_renders '{"component":"IssueRow"}' --session upd-c
agent-browser --session upd-c click '.issue-row:nth-child(4) input[type="checkbox"]'
npx genie-react call react_quiesce '{"idleMs":500,"timeoutMs":10000}' --fail-on-result-error --session upd-c
npx genie-react call react_component_cohort '{"component":"IssueRow","exact":true,"limit":3}' --session upd-c
status: mixed
matched: 100
mountedUpdated: 34
mountedIdle: 0
mountedUnknown: 66
coverage:
  complete: false
  skippedCommitFibers: 66
  budgetExhaustedCommits: 1
  budgetAdvice:
    next: "targetOperationReserve ran out. Run react_clear_renders with {\"budget\":{\"fiberLimit\":750,\"operationLimit\":90000,\"timeLimitMs\":36,\"targetOperationReserve\":12000,\"targetTimeReserveMs\":12}}, repeat the step, and read again."

The first read is incomplete. Genie analyzed 34 rows and ran out of analysis budget for the other 66, so it reports them as mountedUnknown instead of guessing. The same read names the budget to use in budgetAdvice.

With that budget and a click on another row, the count is complete:

status: updated
matched: 100
mountedUpdated: 100
mountedIdle: 0
mountedUnknown: 0
  complete: true

One click, 100 row renders.

Read the cause

react_render_causes names the prop that changed on each row:

npx genie-react call react_render_causes '{"component":"IssueRow","limit":3}' --session upd-c
events[3] (componentName #componentId {fields}, then ← kind evidence name {fields} per cause):
  each: {documentCommitId:29,necessity:unknown,necessityReason:callbacks-changed,inputEvidence:changed,source:{location:…/src/features/issues/issue-table.tsx:48:15,role:element-callsite,ownership:app}}
  IssueRow #92056586364 {renderEventId:render:29:882,mountId:mount:521,key:iss-1754}
    ← props exact onToggle
  IssueRow #92056586345 {renderEventId:render:29:881,mountId:mount:520,key:iss-1700}
    ← props exact onToggle
  IssueRow #92056586325 {renderEventId:render:29:880,mountId:mount:519,key:iss-1681}
    ← props exact onToggle
omittedByLimit: 97

exact means Genie compared the props before and after and saw onToggle change. With "view":"full", one row shows more:

← props exact onToggle {referenceChanged:true,referenceOnly:false,unstable:true,…}
behaviorEvidence:{subtreeHostMutations:{status:none-observed,count:0,callbackOnlyUpdates:2,writes:[],callbacks:[input.onChange,button.onClick]},…}

The row wrote nothing to the DOM. Its only updates were two event handlers. The source location points at line 48 of issue-table.tsx, where the rows are created:

{rows.map((issue) => (
  <IssueRow
    key={issue.id}
    issue={issue}
    selected={selectedIds.includes(issue.id)}
    onToggle={() => this.props.selectionToggled(issue.id)}
    onOpen={this.openIssue}
  />
))}

Why PureComponent does not help

IssueRow extends PureComponent, which skips a render when every prop is === to its previous value. onOpen passes that check, because openIssue is a class field created once. onToggle never does. Selecting a row dispatches selectionToggled, the store's selectedIds changes, connect() re-renders IssueTable, and render() creates 100 new arrows. Every row sees a new function and renders.

A function row wrapped in React.memo has the same problem, because memo also compares each prop with Object.is. Either way, the parent must stop creating a new function per row.

The fix

Pass the bound action creator, which connect() keeps stable, and let the row supply its own id:

--- a/apps/realworld-legacy/src/features/issues/issue-table.tsx
+++ b/apps/realworld-legacy/src/features/issues/issue-table.tsx
-                onToggle={() => this.props.selectionToggled(issue.id)}
+                onToggle={this.props.selectionToggled}
--- a/apps/realworld-legacy/src/features/issues/issue-row.tsx
+++ b/apps/realworld-legacy/src/features/issues/issue-row.tsx
-  onToggle: () => void
+  onToggle: (id: string) => void
-            onChange={onToggle}
+            onChange={() => onToggle(issue.id)}

The row still creates an arrow for onChange, but inside its own render. That arrow reaches only the <input>, so it costs nothing when the row itself skips rendering.

The proof

The claims say what the fix must make true. At most one IssueRow renders, IssueTable renders at least once so a click that misses the app fails, and no error boundary catches. The min 1 claim matters. Zero row renders satisfies max 1, so without a positive control a click that never reached the table could not fail. Before the fix, with the budget Genie advised earlier:

npx genie-react verify begin --session upd-c --name "select one issue row" \
  --claim 'render IssueRow max 1' --claim 'render IssueTable min 1' --claim 'boundaries clean' \
  --budget '{"fiberLimit":750,"operationLimit":90000,"timeLimitMs":36,"targetOperationReserve":12000,"targetTimeReserveMs":12}'
agent-browser --session upd-c click '.issue-row:nth-child(7) input[type="checkbox"]'
npx genie-react verify end vfy_d8a59fdb-cd65-46f3-abce-ce0c38bac77c --session upd-c
fail vfy_d8a59fdb-cd65-46f3-abce-ce0c38bac77c "select one issue row"  3 commits, quiet after 798 ms (react)
  1 fail render IssueRow max 1  {renders:100,mounts:0,updates:100,remounts:0,semantics:lower-bound,instances:100,activeInstances:100}
  2 pass render IssueTable min 1  {renders:1,mounts:0,updates:1,remounts:0,semantics:lower-bound,instances:1,activeInstances:1}
  3 pass boundaries clean  {caughtDuringWindow:0,caughtAtEnd:0}

The command exited 1. A run with the default budget also failed, with renders:28 marked semantics:lower-bound. A lower bound of 28 already breaks max 1, so Genie can fail the claim without the full count. To pass max 1, it needs exact evidence.

After applying the fix and reloading the page, the same claims and the same click:

pass vfy_366cd00a-079a-44f3-8da9-9ea65203b808 "select one issue row"  3 commits, quiet after 937 ms (react)
  1 pass render IssueRow max 1  {renders:1,mounts:0,updates:1,remounts:0,semantics:exact,instances:100,activeInstances:100}
  2 pass render IssueTable min 1  {renders:1,mounts:0,updates:1,remounts:0,semantics:exact,instances:1,activeInstances:1}
  3 pass boundaries clean  {caughtDuringWindow:0,caughtAtEnd:0}
attempt 4 for these claims on this tab; previous fail vfy_40bab0be-c9db-4862-8fcf-593aee12dc03; document reloaded since

The command exited 0. Genie does not look at the screen, so the driver confirmed the checkbox:

agent-browser --session upd-c is checked '.issue-row:nth-child(4) input[type="checkbox"]'
true

A cohort read and react_render_causes after the fix show which row rendered and why:

status: mixed
matched: 100
mountedUpdated: 1
mountedIdle: 99
mountedUnknown: 0
  IssueRow #11840604078113 {…,key:iss-101,necessity:necessary,necessityReason:dom-changed,…}
    ← props exact selected
Rows rendered for one clickCause on each rowverify
Before100 of 100props.onTogglefail, exit 1
After1 of 100props.selectedpass, exit 0

Where this approach stops

  • Genie counted renders, not milliseconds. This run did not measure how long the click took. For timing, take repeated captures and compare them as the optimize guide describes, and remember that development timings do not predict production.
  • The first read on a large list can run out of analysis budget. Genie says so with mountedUnknown and budgetAdvice instead of returning a short count. Follow the advice, repeat the action, and read again.
  • verify decides claims about React. It does not check what the user sees, so confirm the screen with your driver, as above.
  • In the same app, other store actions also re-render IssueTable, because its selector returns a new page object. That is a separate seeded bug. This fix stops the 100 row renders, but IssueTable itself still renders on unrelated actions.

Verify a fix lists every claim form. Renders and effects covers render causes in more depth.

On this page