Repository navigation
fix(react-core): key virtualized messages by id for stable measurements - #6564
Closed
deepshekhardas wants to merge 1 commit into
Closed
deepshekhardas wants to merge 1 commit into
deepshekhardas wants to merge 1 commit into
Conversation
deepshekhardas
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
August 19, 2026 12:54
deepshekhardas
force-pushed
the
fix/virtual-measurement-keys
branch
from
August 21, 2026 06:23
d93e879 to
1a6a7bc
Compare
Contributor
|
Closing the
Happy to see it re-filed on its own merits with a test and without the issue link. Leaving #6089 open. |
This was referenced Sep 2, 2026
Closed
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.
Fixes #6089 (partially)
When
deduplicatedMessagesmerges or drops a message mid-list (duplicate ids from HITL run syncs, double-applied tool-call events), every subsequent message shifts one index. The virtualizer's measurement cache is keyed by index by default, so the cached height of the previous occupant is misattributed to the new item until the ResizeObserver re-fires — the list jumps while scrolling through history.Change
Pass
getItemKeytouseVirtualizerso the virtualizer keys items (measurement cache, React keys, edge-change detection for auto-scroll anchoring) by the stablemessage.idinstead of the positional index:This is the documented TanStack recommendation for dynamic-height lists whose indices can shift:
No behavioral change on the happy path (append-only streaming lists keep stable indices).