Skip to content

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

web: fix diff session not opening after app refresh

Abdullah Atta274395d01b69
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index ed870284a..9bea691b9 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -204,7 +204,8 @@ class EditorStore extends BaseStore<EditorStore> {
const session = getSession(activeSessionId);
if (!session) return;
- if (session.type === "diff") openDiffSession(session.note.id, session.id);
+ if (session.type === "diff" || session.type === "conflicted")
+ openDiffSession(session.note.id, session.id);
else if (session.type === "new") activateSession(session.id);
else openSession(activeSessionId);
}
@@ -316,7 +317,7 @@ class EditorStore extends BaseStore<EditorStore> {
noteOrId: string | Note | BaseTrashItem<Note>,
options: { force?: boolean; activeBlockId?: string } = {}
): Promise<void> => {
- const { getSession } = this.get();
+ const { getSession, openDiffSession } = this.get();
const noteId = typeof noteOrId === "string" ? noteOrId : noteOrId.id;
const session = getSession(noteId);
@@ -324,6 +325,10 @@ class EditorStore extends BaseStore<EditorStore> {
return this.activateSession(noteId, options.activeBlockId);
}
+ if (session && (session.type === "diff" || session.type === "conflicted")) {
+ return openDiffSession(session.note.id, session.id);
+ }
+
if (session && session.id) await db.fs().cancel(session.id);
const note =
@@ -459,7 +464,6 @@ class EditorStore extends BaseStore<EditorStore> {
// do not allow saving of readonly session
if (partial.note?.readonly) return;
- console.log(currentSession);
if (
currentSession.saveState === SaveState.Saving ||
currentSession.id !== id