fix(grid): stable row IDs and live API handle#1425
Open
gcko wants to merge 2 commits into
Open
Conversation
Query rows are tagged with _index by dataFrameToRowObjects, but getRowId was not checking for it. This caused AG Grid to lose row selections when a query re-ran and data was transformed with new random IDs. Added _index as the second priority check (after __rowKey but before rowIndex) to ensure query result rows maintain stable IDs across re-renders. Also added unit tests covering all four priority levels: __rowKey, _index, rowIndex, and random fallback. Signed-off-by: Jared Scott <jared.m.scott@hotmail.com> Signed-off-by: Jared Scott <jared.scott@datarecce.io>
Signed-off-by: Jared Scott <jared.scott@datarecce.io>
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.
Summary
Two complementary fixes for the AG Grid wrapper component to improve row selection stability and handle API correctness:
Use _index for stable row IDs in query results: Query result rows are now tagged with
_indexbydataFrameToRowObjects, but thegetRowIdfunction wasn't checking for it. This caused AG Grid to lose row selections when a query re-ran and data was transformed with new random IDs. Now using_indexas the second priority (after__rowKeybut beforerowIndex) to ensure stable IDs across re-renders.Make handle API live via getters: Changed the handle API to return live values via getters instead of snapshots, ensuring consumers always get the current API reference and DOM element.
Test Plan
__rowKey,_index,rowIndex, and random fallback🤖 Generated with Claude Code