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
fix: run partial state update on sync
ammarahm-edcbfdf3d91620
diff --git a/apps/mobile/src/stores/index.ts b/apps/mobile/src/stores/index.tsindex 0494db3a2..a8d3eafd8 100644--- a/apps/mobile/src/stores/index.ts+++ b/apps/mobile/src/stores/index.ts@@ -6,6 +6,13 @@ import { useMenuStore } from './use-menu-store';import { useNotebookStore } from './use-notebook-store';import { useTagStore } from './use-tag-store';import { useTrashStore } from './use-trash-store';+import Navigation from '../services/navigation';++export function initAfterSync() {+ useMenuStore.getState().setColorNotes();+ useMenuStore.getState().setMenuPins();+ Navigation.queueRoutesForUpdate(...Object.keys(Navigation.routeUpdateFunctions));+}export function initialize() {if (!db) return;diff --git a/apps/mobile/src/utils/hooks/useAppEvents.js b/apps/mobile/src/utils/hooks/useAppEvents.jsindex f7f87af23..2837e3105 100644--- a/apps/mobile/src/utils/hooks/useAppEvents.js+++ b/apps/mobile/src/utils/hooks/useAppEvents.js@@ -27,7 +27,7 @@ import { db } from '../database';import { MMKV } from '../database/mmkv';import { eClearEditor, eCloseProgressDialog, refreshNotesPage } from '../events';import Sync from '../../services/sync';-import { clearAllStores, initialize } from '../../stores';+import { clearAllStores, initAfterSync, initialize } from '../../stores';import { useUserStore } from '../../stores/use-user-store';import { useMessageStore } from '../../stores/use-message-store';import { useSettingStore } from '../../stores/use-setting-store';@@ -73,7 +73,7 @@ export const useAppEvents = () => {console.log(type, total, current);if (type !== 'download') return;if (total < 10 || current % 10 === 0) {- initialize();+ initAfterSync();}};@@ -163,7 +163,7 @@ export const useAppEvents = () => {const onSyncComplete = async () => {console.log('sync complete');- initialize();+ initAfterSync();setLastSynced(await db.lastSynced());setSyncing(false);eSendEvent(eCloseProgressDialog, 'sync_progress');@@ -430,7 +430,7 @@ export const useAppEvents = () => {useNoteStore.getState().setNotes();eSendEvent(refreshNotesPage);MMKV.removeItem('notesAddedFromIntent');- initialize();+ initAfterSync();eSendEvent(refreshNotesPage);}console.log('CHECK INTENT STATE', notesAddedFromIntent || shareExtensionOpened);