( queryClient: QueryClient, )
| 139 | * in the cache. Returns undefined when no data is cached yet. |
| 140 | */ |
| 141 | export const readInfiniteChatsCache = ( |
| 142 | queryClient: QueryClient, |
| 143 | ): TypesGen.Chat[] | undefined => { |
| 144 | const queries = queryClient.getQueriesData<InfiniteChatsCacheData>({ |
| 145 | queryKey: chatsKey, |
| 146 | predicate: isChatListQuery, |
| 147 | }); |
| 148 | for (const [, data] of queries) { |
| 149 | if (data?.pages) { |
| 150 | return data.pages.flat(); |
| 151 | } |
| 152 | } |
| 153 | return undefined; |
| 154 | }; |
| 155 | |
| 156 | /** |
| 157 | * Adds a child chat to its parent's `children` array across all |
no outgoing calls
no test coverage detected