tweak rqkey and cache search for useAllListMembersQuery (#4971)
parent
d5c78b9183
commit
85d70fe3ef
|
@ -19,8 +19,9 @@ const PAGE_SIZE = 30
|
|||
type RQPageParam = string | undefined
|
||||
|
||||
const RQKEY_ROOT = 'list-members'
|
||||
const RQKEY_ROOT_ALL = 'list-members-all'
|
||||
export const RQKEY = (uri: string) => [RQKEY_ROOT, uri]
|
||||
export const RQKEY_ALL = (uri: string) => [RQKEY_ROOT, uri, 'all']
|
||||
export const RQKEY_ALL = (uri: string) => [RQKEY_ROOT_ALL, uri]
|
||||
|
||||
export function useListMembersQuery(uri?: string, limit: number = PAGE_SIZE) {
|
||||
const agent = useAgent()
|
||||
|
@ -118,4 +119,20 @@ export function* findAllProfilesInQueryData(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const allQueryData = queryClient.getQueriesData<
|
||||
AppBskyGraphDefs.ListItemView[]
|
||||
>({
|
||||
queryKey: [RQKEY_ROOT_ALL],
|
||||
})
|
||||
for (const [_queryKey, queryData] of allQueryData) {
|
||||
if (!queryData) {
|
||||
continue
|
||||
}
|
||||
for (const item of queryData) {
|
||||
if (item.subject.did === did) {
|
||||
yield item.subject
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue