Skip to content

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

fix: overlapping note contents when quickly switching (fixes streetwriters/notesnook#561)

thecodrreb16282f1503
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index feed8b1b9..89ea09b0c 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -278,7 +278,7 @@ function Editor({ noteId, nonce }) {
sessionId={sessionId}
onChange={(content, editor) => {
const { id, sessionId } = editorstore.get().session;
- debouncedOnEditorChange(sessionId, id, sessionId, content);
+ debouncedOnEditorChange(id, id, sessionId, content);
debouncedUpdateWordCount(editor);
}}
changeInterval={100}
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index b8acdef8b..14a5c266e 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -174,6 +174,8 @@ class EditorStore extends BaseStore {
}
this.set((state) => {
+ if (state.session.id !== note.id) return;
+
for (let key in session) {
if (key === "content") continue;
state.session[key] = session[key];