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: search invalid date (#647)

gbirman1bd8483422ec
diff --git a/js/app/packages/macro-entity/src/queries/search.ts b/js/app/packages/macro-entity/src/queries/search.ts
index eba115f10b..7392c01239 100644
--- a/js/app/packages/macro-entity/src/queries/search.ts
+++ b/js/app/packages/macro-entity/src/queries/search.ts
@@ -205,9 +205,11 @@ const useMapSearchResponseItem = () => {
threadHits.at(0)?.pretty_sender;
// TODO: we probably want to get the actual latest message info on the full thread
- const latestMessageSentAt = Math.max(
- ...messageHits.map((m) => m.sent_at).filter((m) => m != null)
- );
+ const messagesSentAt = messageHits
+ .map((m) => m.sent_at)
+ .filter((m) => m != null);
+ const latestMessageSentAt =
+ messagesSentAt.length > 0 ? Math.max(...messagesSentAt) : null;
return {
type: 'email',