mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: fix note title sync if note is opened in multiple tabs (#7636)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -128,7 +128,7 @@ test("new tab button should open a new tab", async ({ page }) => {
|
||||
expect(await tabs[1].title()).toBe("Untitled");
|
||||
});
|
||||
|
||||
test("changes in a note opened in multiple tabs should sync", async ({
|
||||
test("content changes in a note opened in multiple tabs should sync", async ({
|
||||
page
|
||||
}) => {
|
||||
const app = new AppModel(page);
|
||||
@@ -359,5 +359,24 @@ test("notes open in multiple tabs should sync color in note properties when colo
|
||||
expect(await note?.properties.isColored("red")).toBe(true);
|
||||
});
|
||||
|
||||
test("notes open in multiple tabs should sync title when title is changed", async ({
|
||||
page
|
||||
}) => {
|
||||
const app = new AppModel(page);
|
||||
await app.goto();
|
||||
const notes = await app.goToNotes();
|
||||
const note = await notes.createNote(NOTE);
|
||||
await notes.editor.setTitle("Todo");
|
||||
await note?.contextMenu.openInNewTab();
|
||||
|
||||
expect(await notes.editor.getTitle()).toBe("Todo");
|
||||
|
||||
await notes.editor.setTitle("Todo - Today");
|
||||
const tabs = await notes.editor.getTabs();
|
||||
await tabs[0].click();
|
||||
|
||||
expect(await notes.editor.getTitle()).toBe("Todo - Today");
|
||||
});
|
||||
|
||||
test.skip("TODO: open a locked note, switch to another note and navigate back", () => {});
|
||||
test.skip("TODO: open a locked note, switch to another note, unlock the note and navigate back", () => {});
|
||||
|
||||
@@ -1012,6 +1012,19 @@ class EditorStore extends BaseStore<EditorStore> {
|
||||
sessionId
|
||||
});
|
||||
}
|
||||
|
||||
if (partial.note?.title !== undefined) {
|
||||
const { sessions } = this.get();
|
||||
for (const session of sessions) {
|
||||
if ("note" in session && session.note.id === note.id) {
|
||||
this.updateSession(session.id, undefined, {
|
||||
note,
|
||||
title: note.title
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setDocumentTitle(
|
||||
settingStore.get().hideNoteTitle ? undefined : note.title
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user