Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): Invalidate thread cache on new message (#1795)

Evan Hutnik992dda447870
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index a5cea1604d..a045fde198 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -42,6 +42,7 @@ import {
type ProjectEntity,
} from '@entity';
import { useQueryClient } from '@queries/client';
+import { emailKeys } from '@queries/email/keys';
import { createEffectOnEntityTypeNotification } from '@notifications';
import { debounce } from '@solid-primitives/scheduled';
import { cn } from '@ui/utils/classname';
@@ -103,6 +104,10 @@ const useSoupNotificationInvalidators = () => {
(notification) => {
refetchSoupEntity(notification.entity_id, 'emailThread');
invalidateSoupEntity(notification.entity_id);
+ // invalidate thread cache so thread gets fetched (with new message) on next load
+ entityQueryClient.invalidateQueries({
+ queryKey: emailKeys.threadMessages(notification.entity_id).queryKey,
+ });
}
);