(queryClient: QueryClient, chatId: string)
| 815 | /** Populate the QueryClient with every query key that is actively |
| 816 | * observed on the /agents/:id detail page. */ |
| 817 | const seedAllActiveQueries = (queryClient: QueryClient, chatId: string) => { |
| 818 | // Infinite sidebar list: ["chats", { archived: false }] |
| 819 | queryClient.setQueryData(infiniteChatsKey({ archived: false }), { |
| 820 | pages: [[makeChat(chatId)]], |
| 821 | pageParams: [0], |
| 822 | }); |
| 823 | // Flat chats list: ["chats"] |
| 824 | queryClient.setQueryData(chatsKey, [makeChat(chatId)]); |
| 825 | // Individual chat: ["chats", chatId] |
| 826 | queryClient.setQueryData(chatKey(chatId), makeChat(chatId)); |
| 827 | // Messages: ["chats", chatId, "messages"] |
| 828 | queryClient.setQueryData(chatMessagesKey(chatId), []); |
| 829 | // Debug runs: ["chats", chatId, "debug-runs"] |
| 830 | queryClient.setQueryData(chatDebugRunsKey(chatId), []); |
| 831 | // Diff contents: ["chats", chatId, "diff-contents"] |
| 832 | queryClient.setQueryData(chatDiffContentsKey(chatId), { files: [] }); |
| 833 | // Cost summary: ["chats", "costSummary", "me", undefined] |
| 834 | queryClient.setQueryData( |
| 835 | chatCostSummaryKey("me", undefined), |
| 836 | {} as TypesGen.ChatCostSummary, |
| 837 | ); |
| 838 | }; |
| 839 | |
| 840 | /** Keys that should NEVER be invalidated by chat message mutations |
| 841 | * because they are completely unrelated to the message flow. */ |
no test coverage detected