Repository navigation
Close the editor when removing rows moves it to a summary row - #4248
Merged
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4248 +/- ##
=======================================
Coverage 99.13% 99.13%
=======================================
Files 46 46
Lines 2192 2193 +1
Branches 964 966 +2
=======================================
+ Hits 2173 2174 +1
Misses 19 19
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y row When rows are removed while a cell is being edited with `closeOnExternalRowChange: false`, the editor can end up on a bottom summary row. It isn't rendered there, but the grid stays in edit mode, so it ignores navigation keys, and the next commit throws from `rows.with()` in `updateRow`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
It updates the state when the position is no longer valid, so the comment about reinitializing the position moves next to that check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
getResolvedValuesCo-Authored-By: Claude Opus 5.5 <[email protected]>
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.
useActivePositionchecks the active position on every render. It resets a position that is no longer in the grid, e.g., after a column or row is removed, and it closes the editor when its row is changed from outside. Both checks now live inresolveActivePosition, previouslygetResolvedValues, soresolvedActivePositionandvalidatedPositionareconsts instead oflets reassigned through destructuring.When rows are removed while a cell is being edited, the editor's
rowIdxcan land on a bottom summary row. That position is still in active bounds, but it isn't in the viewport. Onmain, this broke the grid in two ways:getActiveRow()throws "No row for active position" during render.closeOnExternalRowChange: false, the grid never reads the row, so it stays in edit mode on the summary row, where it renders no editor. It ignores navigation keys, and the next commit, e.g., clicking another cell, throwsRangeError: Invalid indexfromrows.with()inupdateRow.Changes
resolveActivePositionvalidates the position. When a check fails, it updates the state and calls itself with the new position. It skips the checks for the initial position, and theACTIVEposition that replaces an editor is already in bounds, so it recurses at most once.closeOnExternalRowChangeis set to.columns[position.idx]androws[position.rowIdx]instead of callinggetActiveColumn()andgetActiveRow(), which throw when the position isn't a cell, or isn't in the viewport.getActiveColumnandgetActiveRoware declared after the position is resolved.renderEditCell.test.tsxremove the edited row above a bottom summary row, with and withoutcloseOnExternalRowChange: false. Both fail onmainin Chromium, Firefox, and WebKit.React Compiler
The compiled hook uses 33 cache slots instead of 38. On
main, the reassignedlets putgetActiveColumn,getActiveRow, and the checks in one memo block that depends onactivePosition,columns,rows, andsetDraggedOverRowIdx. Now the checks have their own block, andgetActiveColumnonly depends oncolumnsand the resolved position, so it keeps its identity when onlyrowschange.vp run cipasses.🤖 Generated with Claude Code