fix: add condition to prevent queryClient updates for specific file paths (api downloads)

This commit is contained in:
Danny Avila 2025-04-27 02:21:23 -04:00
parent c18b5c95d4
commit e81853623f
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -10,7 +10,7 @@ export default function useAttachmentHandler(queryClient?: QueryClient) {
return ({ data }: { data: TAttachment; submission: EventSubmission }) => {
const { messageId } = data;
if (queryClient) {
if (queryClient && !data?.filepath?.startsWith('/api/files')) {
queryClient.setQueryData([QueryKeys.files], (oldData: TAttachment[] | undefined) => {
return [data, ...(oldData || [])];
});