Skip to content

Commit

Permalink
SALTO-6994: Avoid redundant copy of fetch changes (#6863)
Browse files Browse the repository at this point in the history
  • Loading branch information
ori-moisis authored Nov 28, 2024
1 parent 22bcdf8 commit 9619142
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions packages/cli/src/commands/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,17 @@ export const fetchCommand = async ({
}
}

// Unpack changes to array so we can iterate on them more than once
const changes = [...fetchResult.changes]
cliTelemetry.changes(changes.length)
cliTelemetry.changes(fetchResult.changes.length)

const updatingWsSucceeded = stateOnly
? await applyChangesToState(changes)
? await applyChangesToState(fetchResult.changes)
: await applyChangesToWorkspace({
workspace,
cliTelemetry,
force,
shouldCalcTotalSize,
output,
changes,
changes: fetchResult.changes,
mode,
approveChangesCallback: getApprovedChanges,
applyProgress: fetchProgress,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const toChangesWithPath =

const originalElements = accountElementByFullName(changeID)
if (originalElements.length === 0) {
log.trace(`no original elements found for change element id ${changeID.getFullName()}`)
log.debug('no original elements found for change element id %s', changeID.getFullName())
return [change]
}

Expand Down

0 comments on commit 9619142

Please sign in to comment.