mirror of https://github.com/tooot-app/app
Fix #661
The API does not support a better way to achieve this as suggested. Though the search API accepts a "following" param, and it will return data prioritising following accounts.
This commit is contained in:
parent
8814161e0e
commit
9a289489fa
|
@ -38,6 +38,7 @@ const ComposeRootSuggestions: React.FC = () => {
|
|||
const { isFetching, data, refetch } = useSearchQuery({
|
||||
type: mapSchemaToType(),
|
||||
term: composeState.tag?.raw.substring(1),
|
||||
...(mapSchemaToType() === 'accounts' && { following: true }),
|
||||
options: { enabled: false }
|
||||
})
|
||||
useEffect(() => {
|
||||
|
|
|
@ -275,7 +275,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||
|
||||
setTimeout(() => {
|
||||
flRef.current?.scrollToIndex({
|
||||
index: (ancestorsCache.current?.length || 0),
|
||||
index: ancestorsCache.current?.length || 0,
|
||||
viewOffset: 50
|
||||
})
|
||||
}, 50)
|
||||
|
|
|
@ -9,6 +9,7 @@ export type QueryKeySearch = [
|
|||
type?: 'accounts' | 'hashtags' | 'statuses'
|
||||
term?: string
|
||||
limit?: number
|
||||
following?: boolean
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -19,7 +20,7 @@ export type SearchResult = {
|
|||
}
|
||||
|
||||
const queryFunction = async ({ queryKey, meta }: QueryFunctionContext<QueryKeySearch>) => {
|
||||
const { type, term, limit = 10 } = queryKey[1]
|
||||
const { type, term, limit = 10, following = false } = queryKey[1]
|
||||
if (!term?.length) {
|
||||
return Promise.reject('Empty search term')
|
||||
}
|
||||
|
@ -31,7 +32,8 @@ const queryFunction = async ({ queryKey, meta }: QueryFunctionContext<QueryKeySe
|
|||
q: term,
|
||||
...(type && { type }),
|
||||
limit,
|
||||
resolve: true
|
||||
resolve: true,
|
||||
following
|
||||
},
|
||||
...(meta && { extras: meta })
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue