File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
src/dashboard/Data/Browser Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -982,17 +982,27 @@ class Browser extends DashboardView {
982
982
}
983
983
984
984
async handleFetchedSchema ( ) {
985
- const counts = this . state . counts ;
986
985
if ( this . state . computingClassCounts === false ) {
987
986
this . setState ( { computingClassCounts : true } ) ;
987
+
988
+ const promises = [ ] ;
988
989
for ( const parseClass of this . props . schema . data . get ( 'classes' ) ) {
989
990
const [ className ] = parseClass ;
990
- counts [ className ] = await this . context . getClassCount ( className ) ;
991
+ const promise = this . context . getClassCount ( className ) . then ( count => {
992
+ this . setState ( prevState => ( {
993
+ counts : {
994
+ ...prevState . counts ,
995
+ [ className ] : count
996
+ }
997
+ } ) ) ;
998
+ } ) ;
999
+ promises . push ( promise ) ;
991
1000
}
992
1001
1002
+ await Promise . all ( promises ) ;
1003
+
993
1004
this . setState ( {
994
1005
clp : this . props . schema . data . get ( 'CLPs' ) . toJS ( ) ,
995
- counts,
996
1006
computingClassCounts : false ,
997
1007
} ) ;
998
1008
}
@@ -2192,7 +2202,8 @@ class Browser extends DashboardView {
2192
2202
classes . forEach ( ( value , key ) => {
2193
2203
let count = this . state . counts [ key ] ;
2194
2204
if ( count === undefined ) {
2195
- count = '' ;
2205
+ // Show loading indicator while counts are being computed, empty string if computation is done
2206
+ count = this . state . computingClassCounts ? '...' : '' ;
2196
2207
} else if ( count >= 1000 ) {
2197
2208
count = prettyNumber ( count ) ;
2198
2209
}
You can’t perform that action at this time.
0 commit comments