Skip to content

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

fix useEffects recurring

ammarahm-ed21a533b61222
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 9b2d4d77a..05afe5fb0 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -60,7 +60,7 @@ const App = () => {
return () => {
eUnSubscribeEvent(eStartSyncer, startSyncer);
};
- });
+ },[]);
useEffect(() => {
Initialize().then(() => {
@@ -68,6 +68,7 @@ const App = () => {
let user = await db.user.get();
startSyncer();
dispatch({type: ACTIONS.USER, user: user});
+ dispatch({type: ACTIONS.ALL});
setInit(true);
});
});
diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index 719256c2e..c192448f0 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -174,7 +174,7 @@ export const Container = ({
return () => {
eUnSubscribeEvent(eScrollEvent, onScroll);
};
- });
+ },[]);
// Render
diff --git a/apps/mobile/src/components/Menu/TimeSince.js b/apps/mobile/src/components/Menu/TimeSince.js
index 51b539f09..652aa4f97 100644
--- a/apps/mobile/src/components/Menu/TimeSince.js
+++ b/apps/mobile/src/components/Menu/TimeSince.js
@@ -16,7 +16,7 @@ export const TimeSince = ({time}) => {
clearInterval(interval);
interval = null;
};
- });
+ },[]);
return <Text>{timeAgo}</Text>;
};
diff --git a/apps/mobile/src/components/MergeEditor/index.js b/apps/mobile/src/components/MergeEditor/index.js
index 75366f473..49eaa9aa9 100644
--- a/apps/mobile/src/components/MergeEditor/index.js
+++ b/apps/mobile/src/components/MergeEditor/index.js
@@ -216,7 +216,7 @@ const MergeEditor = () => {
eUnSubscribeEvent(eApplyChanges, applyChanges);
eUnSubscribeEvent(eShowMergeDialog, show);
};
- });
+ },[]);
const onPressKeepFromPrimaryWebView = () => {
if (keepContentFrom == 'primary') {
diff --git a/apps/mobile/src/components/SelectionHeader/index.js b/apps/mobile/src/components/SelectionHeader/index.js
index f17808686..d6c5f139f 100644
--- a/apps/mobile/src/components/SelectionHeader/index.js
+++ b/apps/mobile/src/components/SelectionHeader/index.js
@@ -16,7 +16,6 @@ export const SelectionHeader = () => {
const {colors, selectionMode, selectedItemsList, currentScreen} = state;
const [selectAll, setSelectAll] = useState(false);
- useEffect(() => {}, [currentScreen]);
return (
<Animatable.View
diff --git a/apps/mobile/src/services/NavigationService.js b/apps/mobile/src/services/NavigationService.js
index 09f535b25..eb59c520b 100755
--- a/apps/mobile/src/services/NavigationService.js
+++ b/apps/mobile/src/services/NavigationService.js
@@ -1,8 +1,8 @@
-import { StackActions } from '@react-navigation/routers';
+import { StackActions } from '@react-navigation/native';
import { rootNavigatorRef } from '../utils/refs';
function navigate(name, params) {
- rootNavigatorRef .current?.navigate(name, params);
+ rootNavigatorRef.current?.navigate(name, params);
}
function goBack() {
rootNavigatorRef.current?.goBack();
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index 1199a0af3..0c54d9a9f 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -449,7 +449,7 @@ const Editor = ({noMenu}) => {
return () => {
eUnSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
};
- });
+ },[]);
const _onHardwareBackPress = async () => {
if (editing.currentlyEditing) {