Profile cleanup (react-query refactor) (#1891)
* Only fetch profile tab content when focused * Fix keys * Add missing behaviors to post tabs * Delete old profile mobx model
This commit is contained in:
parent
47204d9551
commit
0501c2be77
7 changed files with 60 additions and 327 deletions
|
@ -7,8 +7,12 @@ type RQPageParam = string | undefined
|
|||
|
||||
export const RQKEY = (did: string) => ['profile-feedgens', did]
|
||||
|
||||
export function useProfileFeedgensQuery(did: string) {
|
||||
export function useProfileFeedgensQuery(
|
||||
did: string,
|
||||
opts?: {enabled?: boolean},
|
||||
) {
|
||||
const {agent} = useSession()
|
||||
const enabled = opts?.enabled !== false
|
||||
return useInfiniteQuery<
|
||||
AppBskyFeedGetActorFeeds.OutputSchema,
|
||||
Error,
|
||||
|
@ -27,5 +31,6 @@ export function useProfileFeedgensQuery(did: string) {
|
|||
},
|
||||
initialPageParam: undefined,
|
||||
getNextPageParam: lastPage => lastPage.cursor,
|
||||
enabled,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ type RQPageParam = string | undefined
|
|||
|
||||
export const RQKEY = (did: string) => ['profile-lists', did]
|
||||
|
||||
export function useProfileListsQuery(did: string) {
|
||||
export function useProfileListsQuery(did: string, opts?: {enabled?: boolean}) {
|
||||
const {agent} = useSession()
|
||||
const enabled = opts?.enabled !== false
|
||||
return useInfiniteQuery<
|
||||
AppBskyGraphGetLists.OutputSchema,
|
||||
Error,
|
||||
|
@ -27,5 +28,6 @@ export function useProfileListsQuery(did: string) {
|
|||
},
|
||||
initialPageParam: undefined,
|
||||
getNextPageParam: lastPage => lastPage.cursor,
|
||||
enabled,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue