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(channels): don't serialize or deserialize pending attachments (#2761)

teoeab420165418
diff --git a/js/app/packages/channel/Input/attachment-tracker.ts b/js/app/packages/channel/Input/attachment-tracker.ts
index 148cbc42d0..b384bd44b4 100644
--- a/js/app/packages/channel/Input/attachment-tracker.ts
+++ b/js/app/packages/channel/Input/attachment-tracker.ts
@@ -26,7 +26,13 @@ export function createInputAttachmentTracker(
);
const [attachments, setAttachments] = options.persistenceKey
- ? makePersisted(raw, { name: options.persistenceKey })
+ ? makePersisted(raw, {
+ name: options.persistenceKey,
+ serialize: (data: InputAttachmentData[]) =>
+ JSON.stringify(data.filter((a) => !a.pending)),
+ deserialize: (data: string) =>
+ (JSON.parse(data) as InputAttachmentData[]).filter((a) => !a.pending),
+ })
: raw;
const maxAttachments = options.maxAttachments ?? 10;