getFirstRoot not work in async/await
YongChingShieh opened this issue · comments
getFirstRoot not work in async/await
my code:
async ngOnInit(): Promise<void> { await this.initTree(); } async initTree(): Promise<void> { const obj = await this.http.post("api/Dictionary/GetDicInfoTree").toPromise(); this.nodes = generateTree(JSON.parse(obj.Extension)); let firstroot = this.tree.treeModel.getFirstRoot(); console.log(firstroot); console.log(this.tree.treeModel); console.log(this.nodes); };
this.tree.treeModel.getFirstRoot() is null but this.nodes is not null
Hi @yongqingxie, what version of the tree are you using? We did a fix for this yesterday. It's in version 11.0.3
. Version 11.0.0
- 11.0.2
have wrong getFirstRoot
calls. Can you try the new version and let me know?
Hi @yongqingxie, what version of the tree are you using? We did a fix for this yesterday. It's in version
11.0.3
. Version11.0.0
-11.0.2
have wronggetFirstRoot
calls. Can you try the new version and let me know?
this my version info
"@angular/core": "~11.1.0",
"@angular/cli": "~11.1.1",
"@angular/compiler-cli": "~11.1.0",
"@angular/language-service": "~11.1.0",
"@circlon/angular-tree-component": "^11.0.3",
if i use async/await
getFirstRoot is null
getNodeById and getNodeByPath is undefined
We had a bit of trouble removing lodash so I thought it might be related. But it's not.
I can reproduce this as well. Will take a look into it and keep you updated.