fix(components): [tree] filter update scheduling error (#20267)

* Update tree-store.ts

fix: the bug #20259 
Ensure the sequence for the traverse step.

* fix(components): [tree] filter update scheduling error

fix(components): [tree] fix bug #20259
Ensure the sequence for the traverse step. If call the traverse without await, the code below will run before the children had been processed, making the parent node invisible.
This commit is contained in:
Anod Chow
2025-04-27 16:47:35 +08:00
committed by GitHub
parent 498acc321b
commit 91ffdbfca6
2 changed files with 2 additions and 2 deletions

View File

@@ -350,7 +350,7 @@ describe('Tree.vue', () => {
const treeWrapper = wrapper.findComponent(Tree)
;(treeWrapper.vm as InstanceType<typeof Tree>).filter('2-1')
await nextTick()
await sleep()
expect(treeWrapper.findAll('.el-tree-node.is-hidden').length).toEqual(3)
})
test('lazy load with filter expand loaded node', async () => {

View File

@@ -79,7 +79,7 @@ export default class TreeStore {
if (index % 80 === 0 && index > 0) {
await nextTick()
}
traverse(child)
await traverse(child)
}
if (!(node as Node).visible && childNodes.length) {