Skip to content

Commit

Permalink
use push + reverse instead of unshift
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed May 2, 2023
1 parent d27f910 commit 7838728
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/grid/x-data-grid-pro/src/utils/tree/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ export const getNodePathInTree = ({
let node = tree[id] as GridGroupNode | GridLeafNode;

while (node.id !== GRID_ROOT_GROUP_ID) {
path.unshift({
path.push({
field: node.type === 'leaf' ? null : node.groupingField,
key: node.groupingKey,
});

node = tree[node.parent!] as GridGroupNode | GridLeafNode;
}

path.reverse();

return path;
};

Expand Down

0 comments on commit 7838728

Please sign in to comment.