File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -283,12 +283,15 @@ class SchemaController {
283283 }
284284
285285 reloadData ( options = { clearCache : false } ) {
286- this . data = { } ;
287- this . perms = { } ;
288286 if ( options . clearCache ) {
289287 this . _cache . clear ( ) ;
290288 }
291- return this . getAllClasses ( options )
289+ if ( this . reloadDataPromise && ! options . clearCache ) {
290+ return this . reloadDataPromise ;
291+ }
292+ this . data = { } ;
293+ this . perms = { } ;
294+ this . reloadDataPromise = this . getAllClasses ( options )
292295 . then ( allSchemas => {
293296 allSchemas . forEach ( schema => {
294297 this . data [ schema . className ] = injectDefaultSchema ( schema ) . fields ;
@@ -303,7 +306,12 @@ class SchemaController {
303306 classLevelPermissions : { }
304307 } ) ;
305308 } ) ;
309+ delete this . reloadDataPromise ;
310+ } , ( err ) => {
311+ delete this . reloadDataPromise ;
312+ throw err ;
306313 } ) ;
314+ return this . reloadDataPromise ;
307315 }
308316
309317 getAllClasses ( options = { clearCache : false } ) {
You can’t perform that action at this time.
0 commit comments