From ae9e80e12e6a11b5bf4017cf76e8edbd7cf87749 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Tue, 11 Feb 2025 12:16:51 +0500 Subject: [PATCH] mobile: fix stuck at loading in editor --- .../mobile/app/screens/editor/tiptap/use-editor.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor.ts b/apps/mobile/app/screens/editor/tiptap/use-editor.ts index bef1acfcf..2a480f734 100644 --- a/apps/mobile/app/screens/editor/tiptap/use-editor.ts +++ b/apps/mobile/app/screens/editor/tiptap/use-editor.ts @@ -1040,6 +1040,17 @@ export const useEditor = ( }, [isDefaultEditor, restoreEditorState]); const onLoad = useCallback(async () => { + const isAppLoading = useSettingStore.getState().isAppLoading; + if (isAppLoading) { + const sub = useSettingStore.subscribe((state) => { + if (!state.isAppLoading) { + sub(); + onLoad(); + } + }); + return; + } + setTimeout(() => { postMessage(NativeEvents.theme, theme); }); @@ -1082,9 +1093,8 @@ export const useEditor = ( }); } } - - state.current.initialLoadCalled = true; } + state.current.initialLoadCalled = true; overlay(false); } }, [