Skip to content

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

fix: duplicate notes being created

thecodrra6e9203e4f00
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 8732656ca..85bb200d5 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -95,8 +95,11 @@ class EditorStore extends BaseStore {
};
saveSession = (oldSession) => {
+ const session = this.get().session;
+ if (session.isSaving) return; // avoid multiple in-queue saves; only save one time.
this.set((state) => (state.session.isSaving = true));
- this._saveFn()(this.get().session).then(async (id) => {
+
+ this._saveFn()(session).then(async (id) => {
const note = db.notes.note(id)?.data;
if (!note) {
noteStore.refresh();