Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork client
119
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix stale searchText in search submit handler (#10251)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

authored by

Eric Bailey
Claude Opus 4.6 (1M context)
and committed by
GitHub
59a2d19c eee2df6d

+12 -10
+12 -10
src/screens/Search/Shell.tsx
··· 96 96 const [activeTab, setActiveTab] = useState(() => getTabIndex(tabParam)) 97 97 98 98 // Query terms 99 - const [searchText, setSearchText] = useState<string>(queryParam) 99 + const [searchText, _setSearchText] = useState<string>(queryParam) 100 + const searchTextRef = useRef(searchText) 101 + const setSearchText = (text: string) => { 102 + searchTextRef.current = text 103 + _setSearchText(text) 104 + } 100 105 const {data: autocompleteData, isFetching: isAutocompleteFetching} = 101 106 useActorAutocompleteQuery(searchText, true) 102 107 ··· 227 232 } 228 233 }, [setShowAutocomplete, setSearchText, navigation, route.params, route.name]) 229 234 230 - const onSubmit = useCallback( 231 - (source: 'typed' | 'autocomplete') => () => { 232 - ax.metric('search:query', { 233 - source, 234 - }) 235 - navigateToItem(searchText) 236 - }, 237 - [ax, navigateToItem, searchText], 238 - ) 235 + const onSubmit = (source: 'typed' | 'autocomplete') => () => { 236 + ax.metric('search:query', { 237 + source, 238 + }) 239 + navigateToItem(searchTextRef.current) 240 + } 239 241 240 242 const onAutocompleteResultPress = useCallback(() => { 241 243 if (IS_WEB) {