Skip to content

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

web: fix `editing a note and switching immediately to another note and editing the title shouldn't overlap both notes` test

Abdullah Atta26df9bfdd81c
diff --git a/apps/web/__e2e__/models/editor.model.ts b/apps/web/__e2e__/models/editor.model.ts
index ee1a978b0..e24c58bba 100644
--- a/apps/web/__e2e__/models/editor.model.ts
+++ b/apps/web/__e2e__/models/editor.model.ts
@@ -128,7 +128,8 @@ export class EditorModel {
async typeTitle(text: string, delay = 0) {
await this.editAndWait(async () => {
await this.title.focus();
- await this.title.press("End");
+ await this.title.selectText();
+ await this.title.press("ArrowRight");
await this.title.type(text, { delay });
});
}
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index 61614add0..39f8d02f5 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -1016,7 +1016,11 @@ class EditorStore extends BaseStore<EditorStore> {
if (partial.note?.title !== undefined) {
const { sessions } = this.get();
for (const session of sessions) {
- if ("note" in session && session.note.id === note.id) {
+ if (
+ "note" in session &&
+ session.note.id === note.id &&
+ session.note.title !== note.title
+ ) {
this.updateSession(session.id, undefined, {
note,
title: note.title