[Session] Add useAgent
hook and replace (#3706)
* Hook it up * Memoize getAgent method * Use one shared reference --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
parent
d8c8e1e854
commit
45d354cd0c
53 changed files with 231 additions and 114 deletions
|
@ -14,7 +14,7 @@ import {
|
|||
|
||||
import {STALE} from '#/state/queries'
|
||||
import {useModerationOpts} from '#/state/queries/preferences'
|
||||
import {getAgent, useSession} from '#/state/session'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
|
||||
const suggestedFollowsQueryKeyRoot = 'suggested-follows'
|
||||
const suggestedFollowsQueryKey = [suggestedFollowsQueryKeyRoot]
|
||||
|
@ -27,6 +27,7 @@ const suggestedFollowsByActorQueryKey = (did: string) => [
|
|||
|
||||
export function useSuggestedFollowsQuery() {
|
||||
const {currentAccount} = useSession()
|
||||
const {getAgent} = useAgent()
|
||||
const moderationOpts = useModerationOpts()
|
||||
|
||||
return useInfiniteQuery<
|
||||
|
@ -77,6 +78,7 @@ export function useSuggestedFollowsQuery() {
|
|||
}
|
||||
|
||||
export function useSuggestedFollowsByActorQuery({did}: {did: string}) {
|
||||
const {getAgent} = useAgent()
|
||||
return useQuery<AppBskyGraphGetSuggestedFollowsByActor.OutputSchema, Error>({
|
||||
queryKey: suggestedFollowsByActorQueryKey(did),
|
||||
queryFn: async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue