mobile: reload editor if rendered view lost

This commit is contained in:
ammarahm-ed
2023-04-25 19:52:04 +05:00
committed by Ammar Ahmed
parent 492a4d16b2
commit 152fee2c29

View File

@@ -580,22 +580,21 @@ export const useEditor = (
const onReady = useCallback(async () => {
if (!(await isEditorLoaded(editorRef, sessionIdRef.current))) {
overlay(true);
setLoading(true);
eSendEvent("webview_reset");
} else {
isDefaultEditor && restoreEditorState();
}
}, [overlay, isDefaultEditor, restoreEditorState]);
}, [isDefaultEditor, restoreEditorState]);
useEffect(() => {
state.current.saveCount = 0;
async () => {
(async () => {
await commands.setSessionId(sessionIdRef.current);
if (sessionIdRef.current) {
if (!state.current?.ready) return;
await onReady();
}
};
})();
}, [sessionId, loading, commands, onReady]);
const onLoad = useCallback(async () => {