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): shorten send toast and show error on failed undo (#4187)

Evan Hutnik25ac2f4b6251
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsx
index 8c173a6e3e..19a0c3b8ac 100644
--- a/js/app/packages/block-email/component/BaseInput.tsx
+++ b/js/app/packages/block-email/component/BaseInput.tsx
@@ -521,7 +521,16 @@ export function BaseInput(props: {
const undoSend = async (draftId: string) => {
try {
- await emailClient.unscheduleMessage({ draftID: draftId });
+ const result = await emailClient.unscheduleMessage(
+ { draftID: draftId },
+ headerLinkId()
+ );
+ // A non-2xx response comes back as an Err Result (it doesn't throw), so
+ // bail before reverting the send appearance in the UI.
+ if (result.isErr()) {
+ toast.failure('Failed to undo send');
+ return;
+ }
queryClient.invalidateQueries({
queryKey: emailKeys.previews._def,
});
diff --git a/js/app/packages/block-email/component/compose/Compose.tsx b/js/app/packages/block-email/component/compose/Compose.tsx
index c261c54b67..a1f9443751 100644
--- a/js/app/packages/block-email/component/compose/Compose.tsx
+++ b/js/app/packages/block-email/component/compose/Compose.tsx
@@ -358,7 +358,16 @@ export function EmailCompose(props: EmailComposeProps) {
const undoSend = async (draftId: string) => {
try {
- await emailClient.unscheduleMessage({ draftID: draftId }, headerLinkId());
+ const result = await emailClient.unscheduleMessage(
+ { draftID: draftId },
+ headerLinkId()
+ );
+ // A non-2xx response comes back as an Err Result (it doesn't throw), so
+ // bail before reverting the send appearance in the UI.
+ if (result.isErr()) {
+ toast.failure('Failed to undo send');
+ return;
+ }
queryClient.invalidateQueries({
queryKey: emailKeys.previews._def,
});
@@ -392,7 +401,7 @@ export function EmailCompose(props: EmailComposeProps) {
},
]
: undefined,
- duration: 10_000,
+ duration: 8_000,
mobile: true,
});
if (data.message.thread_db_id) {