Skip to content

Commit

Permalink
fix: sync locally on local save
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Jan 12, 2024
1 parent 75e92b4 commit ac10fc6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/services/src/Domain/Sync/SyncOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ export type SyncOptions = {

/** If true and sharedVaultUuids is present, excludes sending global syncToken as part of request */
syncSharedVaultsFromScratch?: boolean

/** Override whether the created sync operation is online or offline */
offline?: boolean
}
2 changes: 1 addition & 1 deletion packages/snjs/lib/Services/Sync/SyncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ export class SyncService

const latestItems = await this.prepareForSyncExecution(items, inTimeResolveQueue, beginDate, frozenDirtyIndex)

const online = this.sessionManager.online()
const online = options.offline != undefined ? !options.offline : this.sessionManager.online()

const { operation, mode: syncMode } = await this.createSyncOperation(
latestItems.map((i) => i.payloadRepresentation()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ export class NoteSyncController {
params.isUserModified ? MutationType.UpdateUserTimestamps : MutationType.NoUpdateUserTimestamps,
)

void this.sync.sync({
offline: true,
})

params.onLocalPropagationComplete?.()
}
}

0 comments on commit ac10fc6

Please sign in to comment.