about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-03-06 18:06:13 +0000
committerGitHub <noreply@github.com>2025-03-06 10:06:13 -0800
commit1c16c6ef0aadab784efa76d5d283f01ec9bf5d40 (patch)
tree09e99fdcf8b72d89e5399c5c6ed12c83cc1b3e46 /src
parenta7db0bac6fa42a47f05b9ef5fabc05656a347f08 (diff)
downloadvoidsky-1c16c6ef0aadab784efa76d5d283f01ec9bf5d40.tar.zst
fix cancel button on search posts screen (#7912)
Diffstat (limited to 'src')
-rw-r--r--src/view/screens/Search/Search.tsx9
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)