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: fix flicker when opening a note in new tab
Abdullah Attae37ff88f1f6e
diff --git a/apps/web/__e2e__/models/editor.model.ts b/apps/web/__e2e__/models/editor.model.tsindex f5cabcf32..bcaf2d572 100644--- a/apps/web/__e2e__/models/editor.model.ts+++ b/apps/web/__e2e__/models/editor.model.ts@@ -64,7 +64,7 @@ export class EditorModel {this.tabsList = page.locator(getTestId("tabs"));this.goBackButton = page.locator(getTestId("go-back"));this.goForwardButton = page.locator(getTestId("go-forward"));- this.newTabButton = page.locator(getTestId("new-tab"));+ this.newTabButton = page.locator(getTestId("New tab"));}async waitForLoading(title?: string, content?: string) {diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex 63225f7b9..ec15f30a6 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -657,8 +657,8 @@ class EditorStore extends BaseStore<EditorStore> {const noteId = typeof noteOrId === "string" ? noteOrId : noteOrId.id;const oldTabForNote = getTabsForNote(noteId).at(0);const tabId = options.openInNewTab- ? addTab()- : oldTabForNote?.id || activeTabId || addTab();+ ? addTab(getId())+ : oldTabForNote?.id || activeTabId || addTab(getId());const tab = tabs.find((t) => t.id === tabId);const activeSession = tab && getSession(tab.sessionId);@@ -1157,21 +1157,22 @@ class EditorStore extends BaseStore<EditorStore> {return session as SessionTypeMap[T[number]];};- addTab = () => {+ addTab = (sessionId?: string) => {const id = getId();- const sessionId = tabSessionHistory.add(id);+ const newSessionId = sessionId || tabSessionHistory.add(id);this.set((state) => {state.tabs.push({id,- sessionId+ sessionId: newSessionId});});- this.addSession({- type: "new",- tabId: id,- id: sessionId,- saveState: SaveState.NotSaved- });+ if (!sessionId)+ this.addSession({+ type: "new",+ tabId: id,+ id: newSessionId,+ saveState: SaveState.NotSaved+ });this.focusTab(id);return id;};