Key token transfer rows by token id so rows stop surviving pagination - #3632
Merged
Conversation
An ERC-1155 batch transfer reaches the API as a single log, which the API flattens into one item per transferred token id. Those items share a (transaction_hash, block_hash, log_index) triple, so the React keys built from that triple collided. React tracks pending removals in a key -> fiber map where duplicates overwrite each other, leaving the shadowed fibers unmounted forever: their rows stayed in the table above the rows of every page that followed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #3628
An ERC-1155 batch transfer reaches the API as a single log, which the API flattens into one item per transferred token id. Those items share a
(transaction_hash, block_hash, log_index)triple, so the React keys built from that triple collided — on OP Sepolia, page 1 of?type=ERC-1155held 50 items with only 42 distinct keys.React tracks pending removals in a key → fiber map where duplicates overwrite each other, so the shadowed fibers are never unmounted. Their rows stayed in the table above the rows of every page that followed, which is the reported symptom. It is also why the pinned rows in the issue screenshot show drifting "N minutes ago" values — each is a leftover row with its own still-running timer.
Token transfer rows are now keyed through a shared
getTokenTransferKey, which adds the token id. Applied to the token transfers page (table + mobile list), the address page lists, and the multichain page.Environment variables
None.
Minimum API version
None.
Breaking or incompatible changes
None.
Additional information
Covered by two specs.
TokenTransfersTable.spec.tsxreproduces the reported symptom: it renders a batch-transfer page, swaps in a different page, and asserts that no rows of the old page survive. It fails on the previous key (6 rows instead of 2) and passes now.Note that this narrows the collision rather than making it impossible. EIP-1155 only requires
_idsand_valuesto have equal length, and OpenZeppelin'sERC1155._updateloops over ids without rejecting duplicates, so a batch carrying the same id twice would still collide. No such transfer appears in 600 sampled items across 12 pages. #3631 tracks a generic collision-proof key helper for all lists.