Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

optimize editor reload time

ammarahm-ed89706c15c748
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.js
index cea0c0458..f9156747a 100644
--- a/apps/mobile/AppRootEvents.js
+++ b/apps/mobile/AppRootEvents.js
@@ -68,6 +68,7 @@ const onAppStateChanged = async (state) => {
} else {
updateEvent({type: Actions.NOTES});
eSendEvent(refreshNotesPage);
+ eSendEvent("webviewreset")
}
} catch (e) {
console.log(e);
@@ -136,11 +137,12 @@ export const AppRootEvents = React.memo(
if (!__DEV__) {
try {
- Sentry.init({
+ /* Sentry.init({
dsn:
'https://[email protected]/5519681',
release: '[email protected]',
- });
+
+ }); */
} catch (e) {}
}
}
diff --git a/apps/mobile/src/components/Loading/index.js b/apps/mobile/src/components/Loading/index.js
index cdb916d6f..20cf8856d 100644
--- a/apps/mobile/src/components/Loading/index.js
+++ b/apps/mobile/src/components/Loading/index.js
@@ -1,8 +1,8 @@
import React from 'react';
-import { ActivityIndicator, StyleSheet, View } from 'react-native';
-import { useTracked } from '../../provider';
-import { ph, pv, SIZE } from '../../utils/SizeUtils';
-import { Button } from '../Button';
+import {ActivityIndicator, StyleSheet, View} from 'react-native';
+import {useTracked} from '../../provider';
+import {ph, pv, SIZE} from '../../utils/SizeUtils';
+import {Button} from '../Button';
import Paragraph from '../Typography/Paragraph';
export const Loading = ({
@@ -17,7 +17,12 @@ export const Loading = ({
const {colors} = state;
return (
- <View style={[{height: height,backgroundColor:colors.bg}, styles.activityContainer, customStyle]}>
+ <View
+ style={[
+ {height: height, backgroundColor: colors.bg},
+ styles.activityContainer,
+ customStyle,
+ ]}>
{done ? (
<>
<Paragraph
@@ -32,7 +37,12 @@ export const Loading = ({
) : (
<>
<ActivityIndicator color={colors.accent} />
- <Paragraph color={colors.pri} style={styles.activityText}>
+ <Paragraph
+ size={SIZE.md}
+ style={{
+ marginTop:10
+ }}
+ color={colors.pri}>
{tagline}
</Paragraph>
</>
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index c757fe356..2a60e6b37 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -50,16 +50,18 @@ const Editor = React.memo(
const [state] = useTracked();
const {premiumUser, loading} = state;
const [resetting, setResetting] = useState(false);
-
+ const [localLoading, setLocalLoading] = useState(false);
const onLoad = async () => {
await onWebViewLoad(premiumUser, getCurrentColors());
};
const onResetRequested = async () => {
+ setLocalLoading(true);
setResetting(true);
- await sleep(3000);
- ToastEvent.show('Editor has recovered from crash.', 'success');
+ await sleep(10);
setResetting(false);
+ await sleep(1000);
+ setLocalLoading(false);
};
useEffect(() => {
@@ -78,6 +80,8 @@ const Editor = React.memo(
/>
) : (
<>
+ {localLoading && <Loading tagline="Loading Editor" height="100%" />}
+
<TextInput
ref={textInput}
style={{height: 1, padding: 0, width: 1, position: 'absolute'}}
@@ -101,14 +105,8 @@ const Editor = React.memo(
testID={notesnook.ids.default.editor}
ref={EditorWebView}
onLoad={onLoad}
- onError={(event) => {
- console.log('error', event.nativeEvent);
- ToastEvent.show('Editor Load Error', 'error');
- }}
onRenderProcessGone={(event) => {
- console.log('error', event.nativeEvent);
onResetRequested();
- ToastEvent.show('Editor Render Process Gone', 'error');
}}
javaScriptEnabled={true}
focusable={true}