Skip to content

Commit 4d03446

Browse files
committed
fix(SyncStrategy): Add missing stage 3 execution for local tree
Signed-off-by: Marcel Klehr <[email protected]>
1 parent d8d518f commit 4d03446

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/lib/strategies/Default.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ export default class SyncProcess {
286286
Object.values(this.localPlanStage2).reduce((acc, diff) => diff.getActions().length + acc, 0)
287287
}
288288

289-
if (!this.planStage3Server) {
290-
Logger.log('Executing server stage2 plan')
291-
await this.executeStage2(this.server, this.serverPlanStage2, ItemLocation.SERVER, this.serverDonePlan, this.prelimServerReorders)
289+
Logger.log('Executing server stage2 plan')
290+
await this.executeStage2(this.server, this.serverPlanStage2, ItemLocation.SERVER, this.serverDonePlan, this.prelimServerReorders)
292291

292+
if (!this.planStage3Server) {
293293
if (this.canceled) {
294294
throw new CancelledSyncError()
295295
}
@@ -316,10 +316,11 @@ export default class SyncProcess {
316316
throw new CancelledSyncError()
317317
}
318318

319-
if (!this.planStage3Local) {
320-
Logger.log('Executing local stage 2 plan')
321-
await this.executeStage2(this.localTree, this.localPlanStage2, ItemLocation.LOCAL, this.localDonePlan, this.prelimLocalReorders)
322319

320+
Logger.log('Executing local stage 2 plan')
321+
await this.executeStage2(this.localTree, this.localPlanStage2, ItemLocation.LOCAL, this.localDonePlan, this.prelimLocalReorders)
322+
323+
if (!this.planStage3Local) {
323324
if (this.canceled) {
324325
throw new CancelledSyncError()
325326
}
@@ -339,6 +340,9 @@ export default class SyncProcess {
339340
}
340341
}
341342

343+
Logger.log('Executing local stage 3 plan')
344+
await this.executeStage3(this.localTree, this.planStage3Local, ItemLocation.LOCAL, this.localDonePlan)
345+
342346
// Remove mappings only after both plans have been executed
343347
this.localDonePlan.REMOVE.getActions().forEach(action => this.removeMapping(this.localTree, action.payload))
344348
this.serverDonePlan.REMOVE.getActions().forEach(action => this.removeMapping(this.server, action.payload))

0 commit comments

Comments
 (0)