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: remove db.notes.init
ammarahm-edf51220c9a8a0
diff --git a/apps/mobile/app/hooks/use-app-events.js b/apps/mobile/app/hooks/use-app-events.jsindex 55874ab29..8add889c0 100644--- a/apps/mobile/app/hooks/use-app-events.js+++ b/apps/mobile/app/hooks/use-app-events.js@@ -562,20 +562,6 @@ export const useAppEvents = () => {}}- const loadNotes = useCallback(async () => {- if (appLocked) return;-- setImmediate(() => {- db.notes.init().then(() => {- Walkthrough.init();- initialize();- setImmediate(() => {- setLoading(false);- });- });- });- }, [setLoading, appLocked]);-const IsDatabaseMigrationRequired = useCallback(() => {if (!db.migrations.required() || appLocked) return false;@@ -585,12 +571,13 @@ export const useAppEvents = () => {if (!db.isInitialized) {await db.init();}- loadNotes();+ initialize();+ setLoading(false);},disableClosing: true});return true;- }, [appLocked, loadNotes]);+ }, [appLocked]);useEffect(() => {if (!loading) {@@ -608,8 +595,10 @@ export const useAppEvents = () => {await db.init();}if (IsDatabaseMigrationRequired()) return;- loadNotes();- }, [IsDatabaseMigrationRequired, loadNotes]);+ initialize();+ setLoading(false);+ Walkthrough.init();+ }, [IsDatabaseMigrationRequired]);useEffect(() => {let sub;diff --git a/apps/mobile/app/navigation/navigation-stack.js b/apps/mobile/app/navigation/navigation-stack.jsindex d0498bf29..228e59fe3 100644--- a/apps/mobile/app/navigation/navigation-stack.js+++ b/apps/mobile/app/navigation/navigation-stack.js@@ -188,7 +188,7 @@ const Tabs = React.memo(_Tabs, () => true);const _NavigationStack = () => {const clearSelection = useSelectionStore((state) => state.clearSelection);-+ const loading = useNoteStore((state) => state.loading);const onStateChange = React.useCallback(() => {if (useSelectionStore.getState().selectionMode) {clearSelection(true);@@ -202,7 +202,7 @@ const _NavigationStack = () => {<NavigationContainer onStateChange={onStateChange} ref={rootNavigatorRef}><Tabs /></NavigationContainer>- <TopicsSheet />+ {loading ? null : <TopicsSheet />}</Container>);};diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsindex fdd4dd065..2859a0fd9 100644--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts@@ -62,6 +62,7 @@ import { useDragState } from "../../settings/editor/state";import { EventTypes } from "./editor-events";import { EditorMessage, EditorProps, useEditorType } from "./types";import { EditorEvents, editorState } from "./utils";+import { useNoteStore } from "../../../stores/use-notes-store";const publishNote = async (editor: useEditorType) => {const user = useUserStore.getState().user;@@ -130,6 +131,7 @@ export const useEditorEvents = (const deviceMode = useSettingStore((state) => state.deviceMode);const fullscreen = useSettingStore((state) => state.fullscreen);const corsProxy = useSettingStore((state) => state.settings.corsProxy);+ const loading = useNoteStore((state) => state.loading);const [dateFormat, timeFormat] = useSettingStore((state) => [state.dateFormat,state.timeFormat@@ -168,6 +170,7 @@ export const useEditorEvents = (}, [editor.commands, editor.postMessage]);useEffect(() => {+ if (loading) return;editor.commands.setSettings({deviceMode: deviceMode || "mobile",fullscreen: fullscreen || false,@@ -200,7 +203,8 @@ export const useEditorEvents = (defaultFontSize,defaultFontFamily,dateFormat,- timeFormat+ timeFormat,+ loading]);const onBackPress = useCallback(async () => {diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.jsonindex d8b7a7d4c..59f5412be 100644--- a/apps/mobile/package-lock.json+++ b/apps/mobile/package-lock.json@@ -1,12 +1,12 @@{"name": "@notesnook/mobile",- "version": "2.5.3",+ "version": "2.5.4","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "@notesnook/mobile",- "version": "2.5.3",+ "version": "2.5.4","license": "GPL-3.0-or-later","workspaces": ["native/",