File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -76,16 +76,12 @@ export class OrgListUtil {
7676 * @returns the same scratch org list, but with updated information from the server.
7777 */
7878 public static async processScratchOrgs ( scratchOrgs : ExtendedAuthFields [ ] ) : Promise < ExtendedAuthFields [ ] > {
79- // organize by DevHub to reduce queries
80- const orgIdsGroupedByDevHub : Dictionary < string [ ] > = { } ;
81- scratchOrgs . forEach ( ( fields ) => {
82- if ( fields . devHubUsername ) {
83- if ( ! orgIdsGroupedByDevHub [ fields . devHubUsername ] ) {
84- orgIdsGroupedByDevHub [ fields . devHubUsername ] = [ ] ;
85- }
86- orgIdsGroupedByDevHub [ fields . devHubUsername ] . push ( sfdc . trimTo15 ( fields . orgId ) ) ;
87- }
88- } ) ;
79+ const orgIdsGroupedByDevHub = scratchOrgs
80+ . filter ( ( fields ) => fields . devHubUsername )
81+ . reduce ( ( accum : Dictionary < string [ ] > , fields ) => {
82+ accum [ fields . devHubUsername ] = [ ...( accum [ fields . devHubUsername ] ?? [ ] ) , sfdc . trimTo15 ( fields . orgId ) ] ;
83+ return accum ;
84+ } , { } ) ;
8985 const updatedContents = (
9086 await Promise . all (
9187 Object . entries ( orgIdsGroupedByDevHub ) . map ( async ( [ devHubUsername , orgIds ] ) =>
You can’t perform that action at this time.
0 commit comments