Update list invlidation logic

This commit is contained in:
Nate Kelley 2025-07-21 15:43:43 -06:00
parent 4460e4934b
commit bebdcdc347
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 9 additions and 4 deletions

View File

@ -42,6 +42,7 @@ export const useTrackAndUpdateMessageChanges = (
const { onUpdateChatMessage, onUpdateChat } = useChatUpdate();
const checkIfWeHaveAFollowupDashboard = useCheckIfWeHaveAFollowupDashboard(messageId);
const getChatMemoized = useGetChatMemoized();
const queryClient = useQueryClient();
const subscribe = !!chatId && !!messageId && messageId !== 'undefined';
@ -78,16 +79,20 @@ export const useTrackAndUpdateMessageChanges = (
(reasoningMessage as ChatMessageResponseMessage_File)?.file_type === 'dashboard'
);
});
if (hasFiles) {
prefetchGetChatsList();
}
if (!isEmpty(iChatMessage.response_message_ids)) {
checkIfWeHaveAFollowupDashboard(iChatMessage);
}
if (iChatMessage.is_completed) {
prefetchGetChatsList();
queryClient.invalidateQueries({
queryKey: chatQueryKeys.chatsGetList().queryKey
});
if (hasFiles) {
queryClient.invalidateQueries({
queryKey: metricsQueryKeys.metricsGetList().queryKey
});
}
}
}
callback?.(iChatMessage);