We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2477a44 commit e2470a3Copy full SHA for e2470a3
src/cool/utils/index.ts
@@ -244,13 +244,15 @@ export function revDeepTree(list: any[]) {
244
const arr: any[] = [];
245
let id = 0;
246
247
- function deep(list: any[], parentId: any) {
+ function deep(list: any[], parentId: number) {
248
list.forEach((e) => {
249
if (!e.id) {
250
e.id = id++;
251
}
252
253
- e.parentId = parentId;
+ if (!e.parentId) {
254
+ e.parentId = parentId;
255
+ }
256
257
arr.push(e);
258
@@ -260,7 +262,7 @@ export function revDeepTree(list: any[]) {
260
262
});
261
263
264
- deep(list || [], null);
265
+ deep(list || [], 0);
266
267
return arr;
268
0 commit comments