防御性编程,规避服务端children返回的不是数组时…… update src/utils/tree.ts.

Signed-off-by: 山野羡民 <liyujiang_tk@yeah.net>
This commit is contained in:
山野羡民 2024-12-18 03:02:00 +00:00 committed by Gitee
parent e891a4bfd2
commit b5aa9d24ac
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -376,6 +376,9 @@ export const treeToString = (tree: any[], nodeId) => {
let str = ''
function performAThoroughValidation(arr) {
if (typeof arr === 'undefined' || !Array.isArray(arr) || arr.length === 0) {
return false
}
for (const item of arr) {
if (item.id === nodeId) {
str += ` / ${item.name}`