Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Fix block delete handler for record content update mutation

Hakan Shehu5b0ff0275e74
diff --git a/apps/desktop/src/main/mutations/records/record-content-update.ts b/apps/desktop/src/main/mutations/records/record-content-update.ts
index d69b028c..75fa05e6 100644
--- a/apps/desktop/src/main/mutations/records/record-content-update.ts
+++ b/apps/desktop/src/main/mutations/records/record-content-update.ts
@@ -18,7 +18,6 @@ export class RecordContentUpdateMutationHandler
input: RecordContentUpdateMutationInput
): Promise<RecordContentUpdateMutationOutput> {
const workspace = this.getWorkspace(input.accountId, input.workspaceId);
-
const result = await workspace.entries.updateEntry<RecordAttributes>(
input.recordId,
(attributes) => {
@@ -53,7 +52,11 @@ export class RecordContentUpdateMutationHandler
}
for (const beforeBlock of beforeBlocks) {
- if (!content[beforeBlock.id]) {
+ const afterBlock = afterBlocks.find(
+ (block) => block.id === beforeBlock.id
+ );
+
+ if (!afterBlock) {
delete content[beforeBlock.id];
}
}