Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
fix: workaround for diff hub/remote behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
  • Loading branch information
carsonfarmer committed Oct 23, 2020
1 parent 5632214 commit 3567822
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/remote/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,17 @@ export class Remote {
}
}
case "add": {
await trans.create([obj.after]);
break;
try {
await trans.create([obj.after]);
break;
} catch (err) {
if (err.message.includes("already existent instance")) {
await trans.save([obj.after]);
break;
} else {
throw err;
}
}
}
case "delete": {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/remote/remote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ describe("remote", function () {
await remote.push("dogs");
expect(await changes.count()).to.equal(0);
// Trying again should not lead to any issues
await remote.push(); // Push everything this time... except we have none!
await remote.push("dogs"); // Push everything this time... except we have none!
// Low level checks
const client = createDbClient(remote.config);
const dogs = dexie.table("dogs");
Expand Down

0 comments on commit 3567822

Please sign in to comment.