Skip to content

Commit ae91993

Browse files
committed
update hash when screen is focused
1 parent ba687b4 commit ae91993

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/components/Search/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useIsFocused, useNavigation} from '@react-navigation/native';
1+
import {useFocusEffect, useIsFocused, useNavigation} from '@react-navigation/native';
22
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
33
import type {NativeScrollEvent, NativeSyntheticEvent, StyleProp, ViewStyle, ViewToken} from 'react-native';
44
import {View} from 'react-native';
@@ -174,10 +174,10 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
174174
const {translate} = useLocalize();
175175
const searchListRef = useRef<SelectionListHandle | null>(null);
176176

177-
useEffect(() => {
177+
useFocusEffect(useCallback(() => {
178178
clearSelectedTransactions(hash);
179179
setCurrentSearchHash(hash);
180-
}, [hash, clearSelectedTransactions, setCurrentSearchHash]);
180+
}, [hash, clearSelectedTransactions, setCurrentSearchHash]));
181181

182182
const searchResults = currentSearchResults?.data ? currentSearchResults : lastNonEmptySearchResults;
183183
const isSearchResultsEmpty = !searchResults?.data || isSearchResultsEmptyUtil(searchResults);

0 commit comments

Comments
 (0)