♻️ refactor: Message Cache Clearing Logic into Reusable Helper (#10226)

This commit is contained in:
Danny Avila 2025-10-22 22:02:29 +02:00 committed by GitHub
parent e3d33fed8d
commit d8d5d59d92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 45 additions and 28 deletions

View file

@ -5,6 +5,7 @@ import { QueryKeys, Constants } from 'librechat-data-provider';
import { TooltipAnchor, NewChatIcon, MobileSidebar, Sidebar, Button } from '@librechat/client';
import type { TMessage } from 'librechat-data-provider';
import { useLocalize, useNewConvo } from '~/hooks';
import { clearMessagesCache } from '~/utils';
import store from '~/store';
export default function NewChat({
@ -33,10 +34,7 @@ export default function NewChat({
window.open('/c/new', '_blank');
return;
}
queryClient.setQueryData<TMessage[]>(
[QueryKeys.messages, conversation?.conversationId ?? Constants.NEW_CONVO],
[],
);
clearMessagesCache(queryClient, conversation?.conversationId);
queryClient.invalidateQueries([QueryKeys.messages]);
newConvo();
navigate('/c/new', { state: { focusChat: true } });