From 735ab21ee9959dd74c9b8e7207b8f257fb1743ef Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Tue, 17 Jan 2023 17:05:22 +0500 Subject: [PATCH] mobile: fix incorrect note loaded when note is very large --- apps/mobile/app/screens/editor/loading.js | 34 +++++++++---------- .../app/screens/editor/tiptap/use-editor.ts | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/mobile/app/screens/editor/loading.js b/apps/mobile/app/screens/editor/loading.js index 292e9a8d0..7a0d81742 100644 --- a/apps/mobile/app/screens/editor/loading.js +++ b/apps/mobile/app/screens/editor/loading.js @@ -28,13 +28,14 @@ import { Button } from "../../components/ui/button"; import { IconButton } from "../../components/ui/icon-button"; import Paragraph from "../../components/ui/typography/paragraph"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets"; +import { DDS } from "../../services/device-detection"; import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from "../../services/event-manager"; import { useThemeStore } from "../../stores/use-theme-store"; -import { eClearEditor, eOnLoadNote } from "../../utils/events"; +import { eClearEditor } from "../../utils/events"; import { SIZE } from "../../utils/size"; import { editorState } from "./tiptap/utils"; const EditorOverlay = ({ editorId = "", editor }) => { @@ -64,13 +65,8 @@ const EditorOverlay = ({ editorId = "", editor }) => { opacity.value = 1; translateValue.value = 0; timers.current.error = setTimeout(() => { - if (_loading) { - let note = _loading; - note.forced = true; - eSendEvent(eOnLoadNote + editorId, note); - } setError(true); - }, 4000); + }, 15 * 1000); } else { clearTimers(); setTimeout(() => { @@ -85,7 +81,7 @@ const EditorOverlay = ({ editorId = "", editor }) => { }, 100); } }, - [editorId, opacity, translateValue] + [opacity, translateValue] ); useEffect(() => { @@ -144,15 +140,19 @@ const EditorOverlay = ({ editorId = "", editor }) => { paddingRight: 12 }} > - { - eSendEvent(eClearEditor); - opacity.value = 0; - translateValue.value = 6000; - }} - name="arrow-left" - color={colors.pri} - /> + {DDS.isTablet() ? ( + + ) : ( + { + eSendEvent(eClearEditor); + opacity.value = 0; + translateValue.value = 6000; + }} + name="arrow-left" + color={colors.pri} + /> + )} { eSendEvent( "loadingNote" + editorId, - show ? currentNote.current || data : false + show ? data || currentNote.current : false ); }, [editorId]