Skip to content

Commit

Permalink
fix(cloudsync): to apply deleted-data on outdated case
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed Jul 16, 2024
1 parent d138109 commit 2325950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/live-wallet/src/cloudsync/__tests__/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ describe("CloudSyncSDK basics", () => {
data = { value: "old" };
version = 1;
await expect(sdk.pull(trustchain, creds)).rejects.toThrow(TrustchainOutdated);
expect(data).toEqual(null);
expect(version).toBe(0);
} finally {
data = null;
version = 0;
Expand Down
1 change: 1 addition & 0 deletions libs/live-wallet/src/cloudsync/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class CloudSyncSDK<Schema extends ZodType, Data = z.infer<Schema>> {
// no data, nothing to do
const version = this.getCurrentVersion();
if (version) {
await this.saveNewUpdate({ type: "deleted-data" });
throw new TrustchainOutdated();
}
break;
Expand Down

0 comments on commit 2325950

Please sign in to comment.