Skip to content

Commit

Permalink
fix cancel button on search posts screen (bluesky-social#7912)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzius authored Mar 6, 2025
1 parent a7db0ba commit 1c16c6e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/view/screens/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c16c6e

Please sign in to comment.