Skip to content

Commit 6b331e6

Browse files
committed
releases 3.5.30
1 parent f3548e4 commit 6b331e6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

func/toArrayTree.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ function toArrayTree (array, options) {
6464

6565
parentId = item[optParentKey]
6666
treeMap[id] = treeMap[id] || []
67-
treeMap[parentId] = treeMap[parentId] || []
68-
treeMap[parentId].push(treeData)
6967
treeData[optKey] = id
7068
treeData[optParentKey] = parentId
69+
70+
if (id === parentId) {
71+
parentId = null
72+
console.log('Fix infinite Loop.', item)
73+
}
74+
75+
treeMap[parentId] = treeMap[parentId] || []
76+
treeMap[parentId].push(treeData)
7177
treeData[optChildren] = treeMap[id]
7278
if (optMapChildren) {
7379
treeData[optMapChildren] = treeMap[id]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xe-utils",
3-
"version": "3.5.29",
3+
"version": "3.5.30",
44
"description": "JavaScript 函数库、工具类",
55
"main": "index.js",
66
"unpkg": "dist/xe-utils.umd.min.js",

0 commit comments

Comments
 (0)