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 { 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);