This commit is contained in:
Abdullah Atta
2023-07-04 11:12:31 +05:00
4 changed files with 16 additions and 23 deletions

View File

@@ -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;

View File

@@ -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>
);
};

View File

@@ -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 () => {

View File

@@ -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/",