From 9c92635fd3e38e6ab2cbaf0589691c552eefd1e7 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Wed, 23 Aug 2023 15:51:16 +0800 Subject: [PATCH 1/2] fix(tree-select): resolve async options --- src/tree-select/tree-select.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tree-select/tree-select.ts b/src/tree-select/tree-select.ts index 784400736..fffe57aa9 100644 --- a/src/tree-select/tree-select.ts +++ b/src/tree-select/tree-select.ts @@ -30,7 +30,7 @@ export default class TreeSelect extends SuperComponent { ]; observers = { - value() { + 'value, options, keys, multiple'() { this.buildTreeOptions(); }, }; From 588c3f28d693586fb9af974835431da53b1a5863 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Wed, 23 Aug 2023 15:55:58 +0800 Subject: [PATCH 2/2] fix(tree-select): resolve error when data or options is async --- src/tree-select/tree-select.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tree-select/tree-select.ts b/src/tree-select/tree-select.ts index fffe57aa9..13507fb0e 100644 --- a/src/tree-select/tree-select.ts +++ b/src/tree-select/tree-select.ts @@ -42,6 +42,8 @@ export default class TreeSelect extends SuperComponent { let level = -1; let node = { children: options }; + if (options.length === 0 || (Array.isArray(value) && value.length === 0)) return; + while (node && node.children) { level += 1; const list = node.children.map((item: TreeOptionData) => ({