Skip to content

react-supergrain: drop tbody remount so isKeyed detects keyed rows - #2

Merged
scottmessinger merged 1 commit into
add-supergrainfrom
claude/github-issue-2068-ec89od
Aug 10, 2026
Merged

scottmessinger merged 1 commit into
add-supergrainfrom
claude/github-issue-2068-ec89od

Conversation

@scottmessinger

@scottmessinger scottmessinger commented Aug 10, 2026

Copy link
Copy Markdown
Member

Fixes the isKeyed failure reported on upstream krausest/js-framework-benchmark#2068.

Base is add-supergrain — the branch krausest#2068 points at — so merging this updates that PR.

Cause

The <tbody> was keyed by an epoch counter bumped in run() and clear(), so a rebuild replaced the tbody instead of its rows.

filterTRInNodeList in webdriver-ts/src/isKeyed.ts opens a node only when that node is itself a TR. A replaced TBODY therefore hides its 1000 TRs, and both counters stay at 0.

The rows were keyed by item.id throughout — 0 of 1000 TR elements are reused across a re-run, with or without the epoch — but the test needs the mutations to be visible.

Change

src/main.tsx: removed tbodyEpoch, its two bumps, and key={tbodyEpoch}. One file, +1 / −9.

Verification

npm run isKeyed -- --runner playwright --headless true keyed/react-supergrain now passes:

react-supergrain-v19.2.4 + 7.3.0-keyed is keyed for 'run benchmark' and keyed for 'remove row benchmark' and keyed for 'swap rows benchmark' . It'll appear as keyed in the results

No ERROR: ... is not correctly categorized. The epoch build reproduces the reported failure exactly.

Benchmarks 01_ through 09_ all pass. No measurable perf change — medians within noise over 10 runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EjGtKNCwotZVC23paQe4i6

`npm run isKeyed keyed/react-supergrain` reported the implementation as
non-keyed for the 'run benchmark' with 0 added and 0 removed TRs.

The <tbody> was keyed by an epoch counter that was bumped on run and
clear, so a rebuild replaced the whole tbody instead of its rows. The
keyed detector's MutationObserver watches `table.table` and counts TRs in
each mutation's addedNodes/removedNodes, but filterTRInNodeList only
recurses into a node when that node is itself a TR. A replaced TBODY
therefore hides all 1000 TRs from the count, and the run reads as
non-keyed even though the rows are keyed by item id.

Remove the epoch and let the rows mount and unmount within a stable
tbody. Verified locally: the epoch build reproduces the reported error
exactly, and without it isKeyed reports keyed for run, remove and swap.
The nine CPU benchmarks (01_ through 09_) all complete successfully.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EjGtKNCwotZVC23paQe4i6
@scottmessinger
scottmessinger marked this pull request as ready for review August 10, 2026 21:38
Copilot AI lite review requested due to automatic review settings August 10, 2026 21:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a benchmarking classification issue for the react-supergrain keyed implementation by preventing <tbody> remounts during run()/clear(), so webdriver-ts’s isKeyed logic can observe row reuse correctly.

Changes:

  • Removed the tbodyEpoch counter and its increments on run() and clear().
  • Removed the <tbody key={tbodyEpoch}> that forced <tbody> to remount on rebuilds, preserving the existing <tr> reconciliation visibility for isKeyed.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@scottmessinger
scottmessinger merged commit 8868313 into add-supergrain Aug 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants