fix: row grouping algorithm#999
Merged
lukasmasuch merged 1 commit intoglideapps:mainfrom Jun 18, 2025
Merged
Conversation
fix: typings for RowGroupingMapperResult
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes errors in the row grouping algorithm to better handle edge cases and improve type safety.
- Refactors mapRowIndexToPath to fix an off‐by-one error in row mapping logic.
- Updates the RowGroupingMapperResult type usage and associated tests to ensure accurate row index mapping.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/test/row-grouping-api.test.ts | Adds comprehensive tests to verify row grouping behavior. |
| packages/core/src/data-editor/row-grouping.ts | Adjusts index calculations in the row-mapping algorithm. |
| packages/core/src/data-editor/row-grouping-api.ts | Refines type definitions for the row grouping mapper function. |
Comments suppressed due to low confidence (2)
packages/core/src/data-editor/row-grouping.ts:203
- Consider adding a brief inline comment explaining the '-1' adjustment in the spread 'path: [...group.path, toGo - 1]'. This would improve clarity regarding how the offset is calculated.
if (toGo <= group.rows)
packages/core/src/data-editor/row-grouping-api.ts:12
- Avoid using 'as any' here by refining the type definitions of the mapper result; this would improve type safety and overall code maintainability.
return { ...r, originalIndex: [itemOrRow[0], r.originalIndex], } as any; // FIXME
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.
Enhanced mapRowIndexToPath for edge cases and overflow.
Refined mapper function for type safety.