Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix invalid usage of closeSessions

Abdullah Attaea7afbe93ea5
diff --git a/apps/web/src/stores/attachment-store.ts b/apps/web/src/stores/attachment-store.ts
index d9c8243fc..e011861b9 100644
--- a/apps/web/src/stores/attachment-store.ts
+++ b/apps/web/src/stores/attachment-store.ts
@@ -135,7 +135,10 @@ class AttachmentStore extends BaseStore<AttachmentStore> {
if (await db.attachments.remove(attachment.hash, false)) {
await this.get().refresh();
await useNoteStore.getState().refresh();
- useEditorStore.getState().closeSessions(...linkedNotes);
+ const sessions = linkedNotes
+ .map((id) => useEditorStore.getState().getSessionsForNote(id))
+ .flat();
+ useEditorStore.getState().closeTabs(...sessions.map((s) => s.id));
}
} catch (e) {
console.error(e);