Skip to content

Commit 1d5e388

Browse files
committed
fix: listener updates to not mutate sandbox process objects
1 parent 1e34f35 commit 1d5e388

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/shared/sandboxCommandBase.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,13 @@ export abstract class SandboxCommandBase<T> extends SfCommand<T> {
152152
});
153153

154154
lifecycle.on(SandboxEvents.EVENT_MULTIPLE_SBX_PROCESSES, async (results: SandboxProcessObject[]) => {
155-
const resumingProcess = results.shift() as SandboxProcessObject;
156-
const sbxProcessIds: string[] = [];
157-
const sbxProcessStatuses: string[] = [];
158-
results.map((sbxProc) => {
159-
sbxProcessIds.push(sbxProc.Id);
160-
sbxProcessStatuses.push(sbxProc.Status);
161-
});
155+
const [resumingProcess, ...otherSbxProcesses] = results;
156+
const sbxProcessIds = otherSbxProcesses.map((sbxProcess) => sbxProcess.Id);
157+
const sbxProcessStatuses = otherSbxProcesses.map((sbxProcess) => sbxProcess.Status);
158+
162159
this.warn(
163160
messages.getMessage('warning.MultipleMatchingSandboxProcesses', [
164-
results[0].SandboxName,
161+
otherSbxProcesses[0].SandboxName,
165162
sbxProcessIds.toString(),
166163
sbxProcessStatuses.toString(),
167164
resumingProcess.Id,

test/tsconfig.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"skipLibCheck": true,
66
"strictNullChecks": true,
77
"baseUrl": "../",
8-
"sourceMap": true,
9-
"paths": {
10-
"@salesforce/kit": ["node_modules/@salesforce/kit"],
11-
"@salesforce/core": ["node_modules/@salesforce/core"]
12-
}
8+
"sourceMap": true
139
}
1410
}

0 commit comments

Comments
 (0)