Skip to content

Commit dbea4a1

Browse files
committed
fix(grouping): keep one rowMeta object per leaf row so writes to params.rowMeta stay on that row
1 parent 6e9b663 commit dbea4a1

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
- Quick filter, first keystroke: Chromium 2,127 → 1,813 ms, Firefox 3,283 → 2,789 ms, WebKit 3,646 → 3,166 ms.
3030
- Group by a column + `sum`: Chromium 924 → 693 ms, Firefox 1,879 → 1,776 ms, WebKit 818 → 675 ms.
3131
- Also faster: number filters (144 → 97 ms in Chromium) and mount (804 → 621 ms), from reading plain cells without allocating and computing row heights in one pass.
32-
- Row-grouping leaf rows at the same depth now share one `GridRowMeta` object in `rowMetaMap` (same content as before).
3332

3433
### Internal
3534

‎lib/hooks/useRowGrouping.ts‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,17 +438,12 @@ export function useRowGrouping<R extends GridRowModel>(params: UseRowGroupingPar
438438

439439
const rowMetaMap = useMemo<Map<GridRowId, GridRowMeta>>(() => {
440440
const map = new Map<GridRowId, GridRowMeta>();
441-
// Every leaf at one depth has the same metadata: one object per depth, not one per row.
442-
const leafMetaByDepth: GridRowMeta[] = [];
443441
treeNodes.forEach((node, id) => {
444442
const variants = groupRowVariants.get(id);
445443
if (!variants) {
446-
let leafMeta = leafMetaByDepth[node.depth];
447-
if (!leafMeta) {
448-
leafMeta = { hasChildren: false, treeDepth: node.depth, isGroupRow: false };
449-
leafMetaByDepth[node.depth] = leafMeta;
450-
}
451-
map.set(id, leafMeta);
444+
// One object per row (not shared per depth): `params.rowMeta` is public, and a consumer that
445+
// writes to it must not change other rows.
446+
map.set(id, { hasChildren: false, treeDepth: node.depth, isGroupRow: false });
452447
return;
453448
}
454449
const groupMeta: GridRowMeta = {

0 commit comments

Comments
 (0)