From 928684175024b9a00269de1a65845a1f43ec8d74 Mon Sep 17 00:00:00 2001 From: dfahlander Date: Tue, 27 Jun 2023 14:58:03 +0200 Subject: [PATCH] Fix #1753 --- samples/dexie-cloud-todo-app/src/db/TodoList.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/samples/dexie-cloud-todo-app/src/db/TodoList.ts b/samples/dexie-cloud-todo-app/src/db/TodoList.ts index 2e6c23399..233eddb1b 100644 --- a/samples/dexie-cloud-todo-app/src/db/TodoList.ts +++ b/samples/dexie-cloud-todo-app/src/db/TodoList.ts @@ -164,9 +164,14 @@ export class TodoList extends Entity { // Delete the list db.todoLists.delete(this.id!); - // Delete any tied realm and related access: + // Delete any tied realm and related access. + // If it wasn't shared, this is a no-op but do + // it anyway to make this operation consistent + // in case it was shared by other offline + // client and then syncs. + // No need to delete members - they will be deleted + // automatically when the realm is deleted. const tiedRealmId = getTiedRealmId(this.id); - db.members.where({ realmId: tiedRealmId }).delete(); db.realms.delete(tiedRealmId); } );