diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-03-06 18:06:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-06 10:06:13 -0800 |
commit | 1c16c6ef0aadab784efa76d5d283f01ec9bf5d40 (patch) | |
tree | 09e99fdcf8b72d89e5399c5c6ed12c83cc1b3e46 | |
parent | a7db0bac6fa42a47f05b9ef5fabc05656a347f08 (diff) | |
download | voidsky-1c16c6ef0aadab784efa76d5d283f01ec9bf5d40.tar.zst |
fix cancel button on search posts screen (#7912)
-rw-r--r-- | src/view/screens/Search/Search.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx index c3fe5012c..785e1872e 100644 --- a/src/view/screens/Search/Search.tsx +++ b/src/view/screens/Search/Search.tsx @@ -735,12 +735,17 @@ export function SearchScreenShell({ setShowAutocomplete(false) if (isWeb) { // Empty params resets the URL to be /search rather than /search?q= - navigation.replace('Search', {}) + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const {q: _q, ...parameters} = (route.params ?? {}) as { + [key: string]: string + } + // @ts-expect-error route is not typesafe + navigation.replace(route.name, parameters) } else { setSearchText('') navigation.setParams({q: ''}) } - }, [setShowAutocomplete, setSearchText, navigation]) + }, [setShowAutocomplete, setSearchText, navigation, route.params, route.name]) const onSubmit = React.useCallback(() => { navigateToItem(searchText) |