We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86f12a0 commit eac4b0aCopy full SHA for eac4b0a
src/utils/flattenData.ts
@@ -9,15 +9,15 @@ import type { RowDataType } from '../@types/common';
9
function flattenData<Row extends RowDataType>(treeData: readonly Row[]) {
10
const flattenItems: Row[] = [];
11
12
- function loop(treeData: readonly Row[], parentNode: Row | null) {
+ function loop(treeData, parentNode) {
13
if (!Array.isArray(treeData)) {
14
return;
15
}
16
17
treeData.forEach(rowData => {
18
+ rowData[PARENT_KEY] = parentNode;
19
flattenItems.push({
- ...rowData,
20
- [PARENT_KEY]: parentNode
+ ...rowData
21
});
22
if (rowData.children) {
23
loop(rowData.children, rowData);
0 commit comments