fix(helper): 修正everyTree, 增加isObservableArray判断 (#4484)

This commit is contained in:
刘丹 2022-05-27 22:39:57 +08:00 committed by GitHub
parent fee28e2794
commit 52f507a03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ import {
resolveVariable,
resolveVariableAndFilter
} from 'amis-formula';
import {isObservable} from 'mobx';
import {isObservable, isObservableArray} from 'mobx';
export {
createObject,
@ -937,7 +937,7 @@ export function everyTree<T extends TreeItem>(
paths: Array<T> = [],
indexes: Array<number> = []
): boolean {
if (!Array.isArray(tree)) {
if (!Array.isArray(tree) && !isObservableArray(tree)) {
return false;
}
return tree.every((item, index) => {