mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
fix performance bottleneck
This commit is contained in:
@@ -120,19 +120,25 @@ export const Container = ({
|
||||
};
|
||||
|
||||
const clearSearch = () => {
|
||||
searchResult = null;
|
||||
setText(null);
|
||||
inputRef.current?.setNativeProps({
|
||||
text: '',
|
||||
});
|
||||
dispatch({
|
||||
type: ACTIONS.SEARCH_RESULTS,
|
||||
results: {
|
||||
results: [],
|
||||
type: null,
|
||||
keyword: null,
|
||||
},
|
||||
});
|
||||
if (searchResults.results && searchResults.results.length > 0) {
|
||||
searchResult = null;
|
||||
if (text) {
|
||||
setText(null);
|
||||
}
|
||||
inputRef.current?.setNativeProps({
|
||||
text: '',
|
||||
});
|
||||
dispatch({
|
||||
type: ACTIONS.SEARCH_RESULTS,
|
||||
results: {
|
||||
results: [],
|
||||
type: null,
|
||||
keyword: null,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -167,6 +173,7 @@ export const Container = ({
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
selection.data = data;
|
||||
selection.type = type;
|
||||
eSubscribeEvent(eScrollEvent, onScroll);
|
||||
|
||||
Reference in New Issue
Block a user