Skip to content

Commit 57c5d54

Browse files
committed
fix: use concat rather than array spreading
1 parent 26c4b8f commit 57c5d54

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/resolve/connectionResolver.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class ConnectionResolver {
8181
componentFilter = (component: Partial<FileProperties>): boolean => isPlainObject(component)
8282
): Promise<ResolveConnectionResult> {
8383
// Aggregate array of metadata records in the org
84-
const Aggregator: Array<Partial<FileProperties>> = [];
84+
let aggregator: Array<Partial<FileProperties>> = [];
8585
// Folder component type names. Each array value has the form [type::folder]
8686
const folderComponentTypes: string[] = [];
8787
// Child component type names
@@ -121,7 +121,7 @@ export class ConnectionResolver {
121121
);
122122
}
123123

124-
Aggregator.push(component);
124+
aggregator.push(component);
125125
if (componentType.folderContentType) {
126126
const type = this.registry.getTypeByName(componentType.folderContentType).name;
127127
const folder = component.fullName;
@@ -135,23 +135,26 @@ export class ConnectionResolver {
135135
}
136136

137137
if (folderComponentTypes.length) {
138-
Aggregator.push(...(await this.sendBatchedRequests(folderComponentTypes)));
138+
const folderFileProps = await this.sendBatchedRequests(folderComponentTypes);
139+
aggregator = aggregator.concat(folderFileProps);
139140
}
140141

141142
if (childComponentTypes.size > 0) {
142-
Aggregator.push(...(await this.sendBatchedRequests(Array.from(childComponentTypes))));
143+
const childComponentFileProps = await this.sendBatchedRequests(Array.from(childComponentTypes));
144+
aggregator = aggregator.concat(childComponentFileProps);
143145
}
144146

145147
// If we need to query the list of StandardValueSets (i.e., it's included in this.mdTypeNames)
146148
// make those requests now.
147149
if (shouldQueryStandardValueSets) {
148-
Aggregator.push(...(await this.sendBatchedQueries()));
150+
const svsFileProps = await this.sendBatchedQueries();
151+
aggregator = aggregator.concat(svsFileProps);
149152
}
150153

151154
getLogger().debug(`https request count = ${requestCount}`);
152155

153156
return {
154-
components: Aggregator.filter(componentFilter).map((component) => ({
157+
components: aggregator.filter(componentFilter).map((component) => ({
155158
fullName: ensureString(
156159
component.fullName,
157160
`Component fullName was not set for ${component.fileName ?? '<missing filename>'}`

0 commit comments

Comments
 (0)