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(emails): email threads reactively showing up in soup (#1744)

teo33f511a03304
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 f3d9a681f6..630e9676c0 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
@@ -78,6 +78,7 @@ import { isMobile } from '@core/mobile/isMobile';
import type { SystemSortOption } from '@app/component/next-soup/soup-view/sort-options';
import { usePropertyEditorHotkeys } from '@app/component/property-edit-modal/hooks/usePropertyEditorHotkeys';
import type { SoupItemsQueryFilters } from '@queries/soup/items';
+import { refetchSoupEntity } from '@queries/soup/normalized-cache';
const useSoupNotificationInvalidators = () => {
const notificationSource = useGlobalNotificationSource();
@@ -94,13 +95,18 @@ const useSoupNotificationInvalidators = () => {
}
);
- createEffectOnEntityTypeNotification(notificationSource, 'email', () => {
- entityQueryClient.invalidateQueries({
- // HACK: this needs to be improved, since we use a single query, per entity invalidations
- // become a little more complicated.
- queryKey: queryKeys.all.entity,
- });
- });
+ createEffectOnEntityTypeNotification(
+ notificationSource,
+ 'email',
+ (notification) => {
+ refetchSoupEntity(notification.entity_id, 'emailThread');
+ entityQueryClient.invalidateQueries({
+ // HACK: this needs to be improved, since we use a single query, per entity invalidations
+ // become a little more complicated.
+ queryKey: queryKeys.all.entity,
+ });
+ }
+ );
createEffectOnEntityTypeNotification(
notificationSource,
diff --git a/js/app/packages/queries/soup/normalized-cache/operations.ts b/js/app/packages/queries/soup/normalized-cache/operations.ts
index 6ca2a9a7d4..e240db66e6 100644
--- a/js/app/packages/queries/soup/normalized-cache/operations.ts
+++ b/js/app/packages/queries/soup/normalized-cache/operations.ts
@@ -222,7 +222,9 @@ export async function refetchSoupEntity(
body: filter,
});
- if (isErr(result)) return;
+ if (isErr(result)) {
+ return;
+ }
const [, page] = result;
if (!page.items.length) return;
diff --git a/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs b/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs
index 5cff4de854..eb484a1fb6 100644
--- a/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs
+++ b/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs
@@ -526,7 +526,8 @@ async fn send_notifications(
})?;
let request = SendNotificationRequestBuilder {
- notification_entity: EntityType::Email.with_entity_string(message.db_id.to_string()),
+ notification_entity: EntityType::EmailThread
+ .with_entity_string(message.thread_db_id.to_string()),
notification,
sender_id,
recipient_ids: HashSet::from([recipient]),
diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml
index cb0a8a14ef..d259b70493 100644
--- a/rust/rust-toolchain.toml
+++ b/rust/rust-toolchain.toml
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.93.1"
-components = ["clippy", "rustfmt"]
+components = ["clippy", "rustfmt", "rust-analyzer"]