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
mobile: fix opening tab for the first time
Ammar Ahmed8241bb8ae57c
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor.ts b/apps/mobile/app/screens/editor/tiptap/use-editor.tsindex c03424885..90276f782 100644--- a/apps/mobile/app/screens/editor/tiptap/use-editor.ts+++ b/apps/mobile/app/screens/editor/tiptap/use-editor.ts@@ -547,7 +547,7 @@ export const useEditor = (const item = event.item;// If note is already open in a tab, focus that tab.- if (useTabStore.getState().hasTabForNote(item.id)) {+ if (useTabStore.getState().hasTabForNote(item.id) && !event.newTab) {const tabId = useTabStore.getState().getTabForNote(item.id);if (tabId !== useTabStore.getState().currentTab) {useTabStore.getState().focusTab(tabId as string);@@ -567,28 +567,31 @@ export const useEditor = (: useTabStore.getState().currentTab;// Check if tab needs to be refreshed.- if (- !event.resetTabState &&- tabId &&- event.item.id === useTabStore.getState().getNoteIdForTab(tabId) &&- !localTabState.current?.needsRefresh(- tabId,- isLockedNote,- item.readonly- )- ) {- commands.setLoading(false, tabId);- return;- } else {- localTabState.current?.setEditTime(- item.id,- localTabState.current?.noteEditedTime[item.id] || item.dateEdited- );- localTabState.current?.set(tabId!, {- editedAt:+ if (!event.newTab) {+ if (+ !event.resetTabState &&+ tabId &&+ event.item.id === useTabStore.getState().getNoteIdForTab(tabId) &&+ !localTabState.current?.needsRefresh(+ tabId,+ isLockedNote,+ item.readonly+ )+ ) {+ commands.setLoading(false, tabId);+ return;+ } else {+ localTabState.current?.setEditTime(+ item.id,localTabState.current?.noteEditedTime[item.id] ||- item.dateEdited- });+ item.dateEdited+ );+ localTabState.current?.set(tabId!, {+ editedAt:+ localTabState.current?.noteEditedTime[item.id] ||+ item.dateEdited+ });+ }}currentLoadingNoteId.current = item.id;diff --git a/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts b/apps/mobile/app/screens/editor/tiptap/use-tab-store.tsindex 4adf63fe7..0b70509c7 100644--- a/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts+++ b/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts@@ -202,14 +202,10 @@ export type TabStore = {export const useTabStore = create<TabStore>(persist((set, get) => ({- tabs: [- {- id: "0"- }- ],+ tabs: [],tabSessionHistory: {},- historyNew: ["0"],- currentTab: "0",+ historyNew: [],+ currentTab: undefined,newTabSession: (_id?: string,options?: Omit<Partial<TabSessionItem>, "id">