@@ -480,24 +480,31 @@ async function loadCurrentStrategies(accountOptions, env) {
480480 } ;
481481
482482 const currentStrategies = { } ;
483- for ( const platform of SUPPORTED_PLATFORMS ) {
483+ const platformResults = await Promise . all ( SUPPORTED_PLATFORMS . map ( async ( platform ) => {
484484 const options = Array . isArray ( accountOptions [ platform ] ) ? accountOptions [ platform ] : [ ] ;
485- if ( ! options . length ) continue ;
485+ if ( ! options . length ) return [ platform , { } ] ;
486486 const repository = PLATFORM_REPOSITORIES [ platform ] ;
487- if ( ! repository ) continue ;
488- const platformStrategies = { } ;
487+ if ( ! repository ) return [ platform , { } ] ;
489488
490- for ( const option of options ) {
489+ const optionResults = await Promise . all ( options . map ( async ( option ) => {
491490 const current = await resolveCurrentStrategyForAccount ( {
492491 platform,
493492 option,
494493 optionsCount : options . length ,
495494 repository,
496495 readVariable,
497496 } ) ;
498- if ( current ) platformStrategies [ option . key ] = current ;
497+ return [ option . key , current ] ;
498+ } ) ) ;
499+
500+ const platformStrategies = { } ;
501+ for ( const [ key , current ] of optionResults ) {
502+ if ( current ) platformStrategies [ key ] = current ;
499503 }
504+ return [ platform , platformStrategies ] ;
505+ } ) ) ;
500506
507+ for ( const [ platform , platformStrategies ] of platformResults ) {
501508 if ( Object . keys ( platformStrategies ) . length ) currentStrategies [ platform ] = platformStrategies ;
502509 }
503510 return currentStrategies ;
@@ -1503,6 +1510,7 @@ export const __test = {
15031510 assertConfiguredAccount,
15041511 assertStrategyAllowedForAccount,
15051512 inferAccountSupportedDomains,
1513+ loadCurrentStrategies,
15061514 normalizeAccountOptionsPayload,
15071515 normalizeStrategyProfilesPayload,
15081516 requireSameOrigin,
0 commit comments