* Fix stale search results when files are deleted from posts
* Minor
* cleaned the dependency from useDidUpdate to not trigger unnecessary API call
* Added comment
(cherry picked from commit bfe6852ae7)
Co-authored-by: Rajat Dabade <rajatdabade1997@gmail.com>
This commit is contained in:
parent
74c5a84c0c
commit
46ca08b939
1 changed files with 13 additions and 0 deletions
|
|
@ -374,6 +374,19 @@ const SearchScreen = ({teamId, teams, crossTeamSearchEnabled}: Props) => {
|
|||
}
|
||||
}, [isFocused]);
|
||||
|
||||
useDidUpdate(() => {
|
||||
if (isFocused && lastSearchedValue && showResults) {
|
||||
// requestAnimationFrame for smooth UI updates
|
||||
requestAnimationFrame(() => {
|
||||
handleSearch(searchTeamId, lastSearchedValue);
|
||||
});
|
||||
}
|
||||
|
||||
// Only watch isFocused to re-run search when screen comes back into focus
|
||||
// Removed lastSearchedValue, showResults, handleSearch, searchTeamId from dependencies
|
||||
// to prevent duplicate search calls (these values are updated by handleSearch itself)
|
||||
}, [isFocused]);
|
||||
|
||||
const handleEnterPressed = useCallback(() => {
|
||||
const topScreen = NavigationStore.getVisibleScreen();
|
||||
if (topScreen === Screens.HOME && isFocused) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue