Skip to content

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

web: fix regression with duplicate notes being created when typing fast

Abdullah Atta064b6fb9dc54
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index f2fe6b825..3175f68e0 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -162,7 +162,7 @@ class EditorStore extends BaseStore {
const currentSession = this.get().session;
if (currentSession.readonly && session.readonly !== false) return; // do not allow saving of readonly session
- if (currentSession.saveState === 0 && !currentSession.id && !sessionId)
+ if (currentSession.saveState === 0 || currentSession.id !== sessionId)
return;
this.setSaveState(0);
@@ -281,7 +281,7 @@ class EditorStore extends BaseStore {
};
setSaveState = (saveState) => {
- return this.set((state) => {
+ this.set((state) => {
state.session.saveState = saveState;
});
};