Skip to content

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

fix: params not updating correctly on navigating.

ammarahm-ed5a9737d90004
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js b/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js
index 12a6fb2a5..3cc70daf2 100644
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js
+++ b/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js
@@ -41,12 +41,13 @@ const TagItem = ({tag, close}) => {
type: 'tag',
get: 'tagged',
};
+
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate('NotesPage', params, {
heading: '#' + _tag.title,
id: _tag.id,
type: _tag.type,
});
- eSendEvent(refreshNotesPage, params);
await sleep(300);
close();
};
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index a42128a38..1b303bd6c 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -44,7 +44,8 @@ import {
eOpenAttachmentsDialog,
eOpenMoveNoteDialog,
eOpenPublishNoteDialog,
- eOpenTagsDialog
+ eOpenTagsDialog,
+ refreshNotesPage
} from '../../utils/Events';
import { deleteItems, openLinkInBrowser } from '../../utils/functions';
import { MMKV } from '../../utils/mmkv';
@@ -823,7 +824,8 @@ export const ActionSheetComponent = ({
heading: topic.title,
id: topic.id,
type: topic.type
- };
+ };
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate(routeName, params, headerState);
}}
icon="book-open-outline"
diff --git a/apps/mobile/src/components/Menu/ColorSection.js b/apps/mobile/src/components/Menu/ColorSection.js
index c7c761294..e4abfe29d 100644
--- a/apps/mobile/src/components/Menu/ColorSection.js
+++ b/apps/mobile/src/components/Menu/ColorSection.js
@@ -62,12 +62,13 @@ const ColorItem = ({item, index}) => {
menu: true,
get: 'colored'
};
+
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate('NotesPage', params, {
heading: alias.slice(0, 1).toUpperCase() + alias.slice(1),
id: item.id,
type: 'color'
});
- eSendEvent(refreshNotesPage, params);
Navigation.closeDrawer();
};
diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js
index eacef3f5d..27de1c49e 100644
--- a/apps/mobile/src/components/Menu/TagsSection.js
+++ b/apps/mobile/src/components/Menu/TagsSection.js
@@ -38,13 +38,12 @@ export const TagsSection = () => {
title: item.title,
menu: true
};
-
+ eSendEvent(eOnNewTopicAdded, params);
Navigation.navigate('Notebook', params, {
heading: item.title,
id: item.id,
type: item.type
});
- eSendEvent(eOnNewTopicAdded, params);
} else if (item.type === 'tag') {
params = params = {
...item,
@@ -52,20 +51,20 @@ export const TagsSection = () => {
menu: true,
get: 'tagged'
};
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate('NotesPage', params, {
heading: '#' + db.tags.alias(item.id),
id: item.id,
type: item.type
});
- eSendEvent(refreshNotesPage, params);
} else {
params = {...item, menu: true, get: 'topics'};
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate('NotesPage', params, {
heading: item.title,
id: item.id,
type: item.type
});
- eSendEvent(refreshNotesPage, params);
}
Navigation.closeDrawer();
};
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 026fdce93..be9a145f6 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -1,19 +1,18 @@
-import React, {useEffect} from 'react';
-import {Platform} from 'react-native';
-import {View} from 'react-native';
+import React from 'react';
+import { Platform, View } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import {useTracked} from '../../provider';
-import {useSettingStore} from '../../provider/stores';
-import {eSendEvent} from '../../services/EventManager';
+import { useTracked } from '../../provider';
+import { useSettingStore } from '../../provider/stores';
+import { eSendEvent } from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import {COLORS_NOTE} from '../../utils/Colors';
-import {db} from '../../utils/database';
-import {refreshNotesPage} from '../../utils/Events';
-import {SIZE} from '../../utils/SizeUtils';
-import {ActionIcon} from '../ActionIcon';
-import {Button} from '../Button';
-import {ActionSheetEvent} from '../DialogManager/recievers';
-import {TimeSince} from '../Menu/TimeSince';
+import { COLORS_NOTE } from '../../utils/Colors';
+import { db } from '../../utils/database';
+import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';
+import { SIZE } from '../../utils/SizeUtils';
+import { ActionIcon } from '../ActionIcon';
+import { Button } from '../Button';
+import { ActionSheetEvent } from '../DialogManager/recievers';
+import { TimeSince } from '../Menu/TimeSince';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -31,11 +30,10 @@ function navigateToNotebook(item) {
id: notebook.id,
type: notebook.type
};
+ eSendEvent(eOnNewTopicAdded, params);
Navigation.navigate(routeName, params, headerState);
}
-
-
function navigateToTag(item) {
let tags = db.tags.all;
let _tag = tags.find(t => t.title === item);
@@ -44,12 +42,13 @@ function navigateToTag(item) {
type: 'tag',
get: 'tagged'
};
+
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate('NotesPage', params, {
heading: '#' + _tag.title,
id: _tag.id,
type: _tag.type
});
- eSendEvent(refreshNotesPage, params);
}
const showActionSheet = (item, isTrash) => {
@@ -223,7 +222,9 @@ const NoteItem = ({item, isTrash, tags}) => {
style={{
marginRight: 5
}}
- color={COLORS_NOTE[item.color?.toLowerCase()] || colors.accent}
+ color={
+ COLORS_NOTE[item.color?.toLowerCase()] || colors.accent
+ }
/>
) : null}
diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js
index c5b512f38..41de4be87 100644
--- a/apps/mobile/src/components/NotebookItem/index.js
+++ b/apps/mobile/src/components/NotebookItem/index.js
@@ -4,8 +4,10 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { notesnook } from '../../../e2e/test.ids';
import { useTracked } from '../../provider';
import { useSettingStore } from '../../provider/stores';
+import { eSendEvent } from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import { getTotalNotes, history } from '../../utils';
+import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';
import { SIZE } from '../../utils/SizeUtils';
import { ActionIcon } from '../ActionIcon';
import { Button } from '../Button';
@@ -43,7 +45,9 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
id: topic.id,
type: topic.type
};
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate(routeName, params, headerState);
+
};
return (
diff --git a/apps/mobile/src/components/NotebookItem/wrapper.js b/apps/mobile/src/components/NotebookItem/wrapper.js
index bece436c3..a88961654 100644
--- a/apps/mobile/src/components/NotebookItem/wrapper.js
+++ b/apps/mobile/src/components/NotebookItem/wrapper.js
@@ -1,36 +1,43 @@
import React from 'react';
-import { NotebookItem } from '.';
-import { useSelectionStore } from '../../provider/stores';
+import {NotebookItem} from '.';
+import {useSelectionStore} from '../../provider/stores';
+import {eSendEvent} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import { history } from '../../utils';
+import {history} from '../../utils';
+import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';
import SelectionWrapper from '../SelectionWrapper';
export const NotebookWrapper = React.memo(({item, index}) => {
const isTrash = item.type === 'trash';
- const setSelectedItem = useSelectionStore(state => state.setSelectedItem)
+ const setSelectedItem = useSelectionStore(state => state.setSelectedItem);
const onPress = () => {
-
if (history.selectedItemsList.length > 0 && history.selectionMode) {
setSelectedItem(item);
return;
- } else {
+ } else {
history.selectedItemsList = [];
}
- let routeName = item.type === "topic" ? 'NotesPage' : 'Notebook';
-
- let params = item.type === "topic"
- ? {...item, menu: false}
- : {
- menu: false,
- notebook: item,
- title: item.title,
- };
+ let routeName = item.type === 'topic' ? 'NotesPage' : 'Notebook';
+
+ let params =
+ item.type === 'topic'
+ ? {...item, menu: false}
+ : {
+ menu: false,
+ notebook: item,
+ title: item.title
+ };
let headerState = {
heading: item.title,
id: item.id,
- type: item.type,
+ type: item.type
};
+ if (item.type === 'topic') {
+ eSendEvent(refreshNotesPage, params);
+ } else {
+ eSendEvent(eOnNewTopicAdded, params);
+ }
Navigation.navigate(routeName, params, headerState);
};
return (
diff --git a/apps/mobile/src/components/TagItem/index.js b/apps/mobile/src/components/TagItem/index.js
index 22eeeb82c..b1c2308a2 100644
--- a/apps/mobile/src/components/TagItem/index.js
+++ b/apps/mobile/src/components/TagItem/index.js
@@ -3,8 +3,10 @@ import {useWindowDimensions, View} from 'react-native';
import {notesnook} from '../../../e2e/test.ids';
import {PressableButton} from '../../components/PressableButton';
import {useTracked} from '../../provider';
+import { eSendEvent } from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import { db } from '../../utils/database';
+import {db} from '../../utils/database';
+import {refreshNotesPage} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
import {ActionIcon} from '../ActionIcon';
import {ActionSheetEvent} from '../DialogManager/recievers';
@@ -16,18 +18,19 @@ const TagItem = ({item, index}) => {
const {colors} = state;
const {fontScale} = useWindowDimensions();
const onPress = () => {
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate(
'NotesPage',
{
...item,
type: 'tag',
- get: 'tagged',
+ get: 'tagged'
},
{
heading: '#' + item.title,
id: item.id,
- type: item.type,
- },
+ type: item.type
+ }
);
};
@@ -46,17 +49,17 @@ const TagItem = ({item, index}) => {
borderBottomWidth: 1.5,
borderBottomColor: colors.nav,
width: '100%',
- justifyContent: 'space-between',
+ justifyContent: 'space-between'
}}>
<View
style={{
- maxWidth: '92%',
+ maxWidth: '92%'
}}>
<Heading size={SIZE.md}>
<Heading
size={SIZE.md}
style={{
- color: colors.accent,
+ color: colors.accent
}}>
#
</Heading>
@@ -66,7 +69,7 @@ const TagItem = ({item, index}) => {
color={colors.icon}
size={SIZE.xs}
style={{
- marginTop: 5,
+ marginTop: 5
}}>
{item && item.noteIds.length && item.noteIds.length > 1
? item.noteIds.length + ' notes'
@@ -90,7 +93,7 @@ const TagItem = ({item, index}) => {
height: 35,
width: 35,
borderRadius: 100,
- alignItems: 'center',
+ alignItems: 'center'
}}
/>
</PressableButton>
diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.js
index c26991ed6..a1e6bcb55 100755
--- a/apps/mobile/src/utils/index.js
+++ b/apps/mobile/src/utils/index.js
@@ -292,12 +292,13 @@ export const MenuItemsList = [
title: 'Monographs',
id: 'monographs_navigation'
});
+
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate('NotesPage', params, {
heading: 'Monographs',
id: 'monographs_navigation',
type: 'notes'
});
- eSendEvent(refreshNotesPage, params);
}
},
{
diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.js
index ae83bf460..185ae77ec 100644
--- a/apps/mobile/src/views/Favorites/index.js
+++ b/apps/mobile/src/views/Favorites/index.js
@@ -28,7 +28,6 @@ export const Favorites = ({route, navigation}) => {
setFavorites();
});
});
- eSendEvent(eScrollEvent, {name: 'Favorites', type: 'in'});
updateSearch();
ranAfterInteractions = false;
};
@@ -65,7 +64,6 @@ export const Favorites = ({route, navigation}) => {
return () => {
pageIsLoaded = false;
ranAfterInteractions = false;
- eSendEvent(eScrollEvent, {name: 'Notebooks', type: 'back'});
navigation.removeListener('focus', onFocus);
};
}, []);
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js
index fb5663147..b0a4d973a 100644
--- a/apps/mobile/src/views/Folders/index.js
+++ b/apps/mobile/src/views/Folders/index.js
@@ -43,7 +43,6 @@ export const Folders = ({route, navigation}) => {
setNotebooks()
});
});
- eSendEvent(eScrollEvent, {name: 'Notebooks', type: 'in'});
updateSearch();
ranAfterInteractions = false;
};
@@ -54,7 +53,6 @@ export const Folders = ({route, navigation}) => {
ranAfterInteractions = false;
pageIsLoaded = false;
navigation.removeListener('focus', onFocus);
- eSendEvent(eScrollEvent, {name: 'Notebooks', type: 'back'});
};
}, []);
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index 15b976118..6b0352af1 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -46,7 +46,6 @@ export const Home = ({navigation}) => {
const runAfterInteractions = () => {
updateSearch();
- eSendEvent(eScrollEvent, {name: 'Notes', type: 'in'});
InteractionManager.runAfterInteractions(() => {
Navigation.routeNeedsUpdate('Notes', () => {
@@ -61,7 +60,6 @@ export const Home = ({navigation}) => {
navigation.addListener('blur', onBlur);
return () => {
ranAfterInteractions = false;
- eSendEvent(eScrollEvent, {name: 'Notes', type: 'back'});
navigation.removeListener('focus', onFocus);
navigation.removeListener('blur', onBlur);
};
diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.js
index 014ebf1ea..35e17a308 100644
--- a/apps/mobile/src/views/Notebook/index.js
+++ b/apps/mobile/src/views/Notebook/index.js
@@ -1,8 +1,8 @@
-import {groupArray} from 'notes-core/utils/grouping';
-import React, {useEffect, useState} from 'react';
-import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
-import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
-import {Header} from '../../components/Header';
+import { groupArray } from 'notes-core/utils/grouping';
+import React, { useEffect, useRef, useState } from 'react';
+import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';
+import { ContainerTopSection } from '../../components/Container/ContainerTopSection';
+import { Header } from '../../components/Header';
import SelectionHeader from '../../components/SelectionHeader';
import SimpleList from '../../components/SimpleList';
import {
@@ -12,13 +12,12 @@ import {
} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import SearchService from '../../services/SearchService';
-import {InteractionManager} from '../../utils';
-import {db} from '../../utils/database';
+import { InteractionManager } from '../../utils';
+import { db } from '../../utils/database';
import {
eOnNewTopicAdded,
eOpenAddNotebookDialog,
- eOpenAddTopicDialog,
- eScrollEvent
+ eOpenAddTopicDialog
} from '../../utils/Events';
export const Notebook = ({route, navigation}) => {
@@ -28,35 +27,22 @@ export const Notebook = ({route, navigation}) => {
db.settings.getGroupOptions('topics')
)
);
- let params = route.params;
- let ranAfterInteractions = false;
+ const params = useRef(route.params);
- const runAfterInteractions = (time = 300) => {
- InteractionManager.runAfterInteractions(() => {
- Navigation.routeNeedsUpdate('Notebook', () => {
- onLoad();
- });
- }, time);
+ const onLoad = data => {
+ if (data) params.current = data;
try {
- let notebook = db.notebooks.notebook(params?.notebook?.id)?.data;
+ let notebook = db.notebooks.notebook(params?.current?.notebook?.id)?.data;
if (notebook) {
- params.notebook = notebook;
+ params.current.notebook = notebook;
setTopics(
groupArray(notebook.topics, db.settings.getGroupOptions('topics'))
);
- params.title = params.notebook.title;
+ params.current.title = params.current.notebook.title;
}
- eSendEvent(eScrollEvent, {name: params.title, type: 'in'});
updateSearch();
- ranAfterInteractions = false;
} catch (e) {}
};
- const onLoad = data => {
- if (data) {
- params = data;
- }
- runAfterInteractions(data ? 300 : 1);
- };
useEffect(() => {
eSubscribeEvent(eOnNewTopicAdded, onLoad);
@@ -66,13 +52,12 @@ export const Notebook = ({route, navigation}) => {
}, []);
const onFocus = async () => {
- if (!ranAfterInteractions) {
- ranAfterInteractions = true;
- runAfterInteractions();
- }
+ InteractionManager.runAfterInteractions(() => {
+ Navigation.routeNeedsUpdate(Navigation.routeNames.Notebook, onLoad);
+ }, 150);
Navigation.setHeaderState('Notebook', params, {
- heading: params.title,
- id: params.notebook.id,
+ heading: params.current.title,
+ id: params.current.notebook.id,
type: 'notebook'
});
};
@@ -80,8 +65,6 @@ export const Notebook = ({route, navigation}) => {
useEffect(() => {
navigation.addListener('focus', onFocus);
return () => {
- ranAfterInteractions = false;
- eSendEvent(eScrollEvent, {name: params.title, type: 'back'});
navigation.removeListener('focus', onFocus);
};
}, []);
@@ -94,15 +77,15 @@ export const Notebook = ({route, navigation}) => {
const updateSearch = () => {
SearchService.update({
- placeholder: `Search in "${params.title}"`,
+ placeholder: `Search in "${params.current.title}"`,
data: topics,
type: 'topics',
- title: params.title
+ title: params.current.title
});
};
const _onPressBottomButton = () => {
- let n = params.notebook;
+ let n = params.current.notebook;
eSendEvent(eOpenAddTopicDialog, {notebookId: n.id});
};
@@ -111,15 +94,16 @@ export const Notebook = ({route, navigation}) => {
<SelectionHeader screen="Notebook" />
<ContainerTopSection>
<Header
- title={params.title}
- isBack={!params.menu}
+ title={params.current.title}
+ isBack={!params.current.menu}
screen="Notebook"
action={_onPressBottomButton}
rightButtons={[
{
icon: 'pencil',
title: 'Edit notebook',
- func: () => eSendEvent(eOpenAddNotebookDialog, params.notebook)
+ func: () =>
+ eSendEvent(eOpenAddNotebookDialog, params.current.notebook)
}
]}
/>
@@ -132,16 +116,16 @@ export const Notebook = ({route, navigation}) => {
}}
screen="Notebook"
headerProps={{
- heading: params.title,
+ heading: params.current.title,
paragraph: 'Edit notebook',
onPress: () => {
- eSendEvent(eOpenAddNotebookDialog, params.notebook);
+ eSendEvent(eOpenAddNotebookDialog, params.current.notebook);
},
icon: 'pencil'
}}
focused={() => navigation.isFocused()}
placeholderData={{
- heading: params.notebook.title,
+ heading: params.current.notebook.title,
paragraph: 'You have not added any topics yet.',
button: 'Add a topic',
action: _onPressBottomButton,
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index f1fa7fbe7..ce8e479a2 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -109,13 +109,6 @@ export const Notes = ({route, navigation}) => {
const onFocus = () => {
init();
- eSendEvent(eScrollEvent, {
- name:
- params.type === 'tag'
- ? '#' + alias
- : alias.slice(0, 1).toUpperCase() + alias.slice(1),
- type: 'in'
- });
};
const onBlur = useCallback(() => {
@@ -129,13 +122,6 @@ export const Notes = ({route, navigation}) => {
navigation.addListener('focus', onFocus);
navigation.addListener('blur', onBlur);
return () => {
- eSendEvent(eScrollEvent, {
- name:
- params.type === 'tag'
- ? '#' + alias
- : alias.slice(0, 1).toUpperCase() + alias.slice(1),
- type: 'hide'
- });
editing.actionAfterFirstSave = {
type: null
};
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 8261696c6..b4472c7bc 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -104,7 +104,6 @@ export const Settings = ({navigation}) => {
let pageIsLoaded = false;
const onFocus = useCallback(() => {
- eSendEvent(eScrollEvent, {name: 'Settings', type: 'in'});
eSendEvent(eUpdateSearchState, {
placeholder: '',
data: [],
@@ -143,7 +142,6 @@ export const Settings = ({navigation}) => {
return () => {
pageIsLoaded = false;
- eSendEvent(eScrollEvent, {name: 'Settings', type: 'back'});
navigation.removeListener('focus', onFocus);
};
}, []);
diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.js
index 104eaf0a6..d77f90a1c 100644
--- a/apps/mobile/src/views/Tags/index.js
+++ b/apps/mobile/src/views/Tags/index.js
@@ -22,7 +22,6 @@ export const Tags = ({route, navigation}) => {
setTags();
});
});
- eSendEvent(eScrollEvent, {name: 'Tags', type: 'in'});
updateSearch();
ranAfterInteractions = false;
};
@@ -48,7 +47,6 @@ export const Tags = ({route, navigation}) => {
navigation.addListener('focus', onFocus);
return () => {
ranAfterInteractions = false;
- eSendEvent(eScrollEvent, {name: 'Tags', type: 'back'});
navigation.removeListener('focus', onFocus);
};
}, []);
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index 01d2b7a9f..ac322ca9f 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -26,8 +26,6 @@ export const Trash = ({route, navigation}) => {
setTrash();
});
});
-
- eSendEvent(eScrollEvent, {name: 'Trash', type: 'in'});
updateSearch();
ranAfterInteractions = false;
};
@@ -62,7 +60,6 @@ export const Trash = ({route, navigation}) => {
return () => {
pageIsLoaded = false;
ranAfterInteractions = false;
- eSendEvent(eScrollEvent, {name: 'Trash', type: 'back'});
navigation.removeListener('focus', onFocus);
};
}, []);