A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: ignore notes in other tabs when navigating back
Abdullah Atta62da8484ada4
diff --git a/apps/web/__e2e__/tabs.test.ts b/apps/web/__e2e__/tabs.test.tsindex e63d0fd74..9fa55517d 100644--- a/apps/web/__e2e__/tabs.test.ts+++ b/apps/web/__e2e__/tabs.test.ts@@ -230,5 +230,27 @@ test("clicking on a note that's already opened in another tab should focus the texpect(await tabs[0].isActive()).toBe(true);});+test("open a note in 2 tabs then open another note and navigate back", async ({+ page+}) => {+ const app = new AppModel(page);+ await app.goto();+ const notes = await app.goToNotes();+ const note = await notes.createNote({+ title: "Note 1"+ });+ await note?.contextMenu.openInNewTab();+ await notes.editor.waitForLoading();+ await notes.createNote({+ title: "Note 2"+ });++ await notes.editor.goBack();++ const tabs = await notes.editor.getTabs();+ expect(await tabs[1].isActive()).toBe(true);+ expect(await tabs[1].title()).toBe("Note 1");+});+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", () => {});diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsxindex f95be9a4d..b6d38accd 100644--- a/apps/web/src/components/editor/action-bar.tsx+++ b/apps/web/src/components/editor/action-bar.tsx@@ -359,7 +359,7 @@ function TabStrip() {type={session.type}onFocus={() => {if (tab.id !== currentTab) {- useEditorStore.getState().focusTab(tab.id);+ useEditorStore.getState().activateSession(tab.sessionId);}}}onClose={() => useEditorStore.getState().closeTabs(tab.id)}diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex ec15f30a6..ad38d969e 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -655,7 +655,7 @@ class EditorStore extends BaseStore<EditorStore> {addTab} = this.get();const noteId = typeof noteOrId === "string" ? noteOrId : noteOrId.id;- const oldTabForNote = getTabsForNote(noteId).at(0);+ const oldTabForNote = options.force ? null : getTabsForNote(noteId).at(0);const tabId = options.openInNewTab? addTab(getId()): oldTabForNote?.id || activeTabId || addTab(getId());