File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments