Skip to content

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

web: activate a new note session on tab rehydration

Abdullah Attaa9a5ba09ffee
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index 137cd39b9..e50ac79d7 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -495,14 +495,19 @@ class EditorStore extends BaseStore<EditorStore> {
};
private rehydrateSession = (sessionId: string) => {
- const { openSession, openDiffSession, getSession } = this.get();
+ const { openSession, openDiffSession, getSession, activateSession } =
+ this.get();
const session = getSession(sessionId);
+ if (session?.type === "new") {
+ activateSession(session.id);
+ return;
+ }
if (!session || !session.needsHydration) return;
if (session.type === "diff")
openDiffSession(session.note.id, session.historySessionId);
- else if (session.type !== "new")
+ else
openSession(session.note.id, {
force: true
});