Skip to content

Commit 201807b

Browse files
Sassoun Derderianv-genn
authored andcommitted
fix: row grouping algorithm
fixes glideapps#823 (comment) 4th point
1 parent 96d1830 commit 201807b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/core/src/data-editor/row-grouping.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@ export function mapRowIndexToPath(row: number, flattenedRowGroups?: readonly Fla
199199
contentIndex: -1,
200200
groupRows: group.rows,
201201
};
202-
toGo--;
203202
if (!group.isCollapsed) {
204-
if (toGo < group.rows)
203+
if (toGo <= group.rows)
205204
return {
206205
path: [...group.path, toGo],
207206
originalIndex: group.headerIndex + toGo,
@@ -210,7 +209,9 @@ export function mapRowIndexToPath(row: number, flattenedRowGroups?: readonly Fla
210209
contentIndex: group.contentIndex + toGo,
211210
groupRows: group.rows,
212211
};
213-
toGo -= group.rows;
212+
toGo = toGo - group.rows - 1;
213+
} else {
214+
toGo--;
214215
}
215216
}
216217
// this shouldn't happen

0 commit comments

Comments
 (0)