MCPcopy Create free account
hub / github.com/coder/coder / readInfiniteChatsCache

Function readInfiniteChatsCache

site/src/api/queries/chats.ts:141–154  ·  view source on GitHub ↗
(
	queryClient: QueryClient,
)

Source from the content-addressed store, hash-verified

139 * in the cache. Returns undefined when no data is cached yet.
140 */
141export 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

Callers 3

connectFunction · 0.90
reorderPinnedChatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected