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:
Paul Frazee 2023-11-13 15:12:41 -08:00 committed by GitHub
parent 47204d9551
commit 0501c2be77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 327 deletions

View file

@ -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,
})
}

View file

@ -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,
})
}