Bluesky app fork with some witchin' additions 💫

tweak rqkey and cache search for useAllListMembersQuery (#4971)

authored by hailey.at and committed by

GitHub 85d70fe3 d5c78b91

+18 -1
+18 -1
src/state/queries/list-members.ts
··· 19 19 type RQPageParam = string | undefined 20 20 21 21 const RQKEY_ROOT = 'list-members' 22 + const RQKEY_ROOT_ALL = 'list-members-all' 22 23 export const RQKEY = (uri: string) => [RQKEY_ROOT, uri] 23 - export const RQKEY_ALL = (uri: string) => [RQKEY_ROOT, uri, 'all'] 24 + export const RQKEY_ALL = (uri: string) => [RQKEY_ROOT_ALL, uri] 24 25 25 26 export function useListMembersQuery(uri?: string, limit: number = PAGE_SIZE) { 26 27 const agent = useAgent() ··· 115 116 yield item.subject 116 117 } 117 118 } 119 + } 120 + } 121 + } 122 + 123 + const allQueryData = queryClient.getQueriesData< 124 + AppBskyGraphDefs.ListItemView[] 125 + >({ 126 + queryKey: [RQKEY_ROOT_ALL], 127 + }) 128 + for (const [_queryKey, queryData] of allQueryData) { 129 + if (!queryData) { 130 + continue 131 + } 132 + for (const item of queryData) { 133 + if (item.subject.did === did) { 134 + yield item.subject 118 135 } 119 136 } 120 137 }