Skip to content

Commit 93aa5c1

Browse files
committed
fix: post item update in category list
1 parent d8928ac commit 93aa5c1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tree-view/provider/post-category-tree-data-provider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class PostCatTreeDataProvider implements TreeDataProvider<PostCatListTree
5151
if (this.isLoading) return Promise.resolve([])
5252

5353
if (item === undefined) {
54-
return PostCatService.getAll().then(list => list.map(c => new PostCatTreeItem(c)))
54+
return this.getRoots()
5555
} else if (item instanceof PostCatTreeItem) {
5656
const categoryId = item.category.categoryId
5757
return Promise.all([this.getCategories(categoryId), this.getPost(item)]).then(
@@ -93,6 +93,11 @@ export class PostCatTreeDataProvider implements TreeDataProvider<PostCatListTree
9393
})
9494
}
9595

96+
private async getRoots() {
97+
this._roots = await PostCatService.getAll().then(list => list.map(c => new PostCatTreeItem(c)))
98+
return this._roots
99+
}
100+
96101
private async getPost(parent: PostCatTreeItem): Promise<PostTreeItem[]> {
97102
const catId = parent.category.categoryId
98103

0 commit comments

Comments
 (0)