From 313aa06e716539262732d079bde76e31862aded4 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 1 Aug 2026 05:13:43 -0400 Subject: [PATCH] fix: close UIKit modal when viewSubmit returns success with no type field When a Rocket.Chat App responds to a viewSubmit interaction with a bare success response ({ success: true }, no type field), the modal now closes correctly instead of throwing an unhandled error that gets swallowed silently. Fixes #7503 --- app/lib/methods/actions.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/lib/methods/actions.ts b/app/lib/methods/actions.ts index 7945f9ad7a5..e6fe8bda16f 100644 --- a/app/lib/methods/actions.ts +++ b/app/lib/methods/actions.ts @@ -155,9 +155,14 @@ export async function triggerAction({ } const { type: interactionType, ...data } = parsed; - const modalType = toServerModalInteractionType(interactionType ?? ''); + if (interactionType === undefined) { + // A bare { success: true } response (no type field) is a valid + // "done, nothing more to render" signal — treat it as modal.close. + return ModalActions.CLOSE; + } + const modalType = toServerModalInteractionType(interactionType); if (!modalType) { - throw new Error(`Unknown modal interaction type: ${interactionType ?? 'undefined'}`); + throw new Error(`Unknown modal interaction type: ${interactionType}`); } if (modalType === ModalActions.CLOSE) { return ModalActions.CLOSE; @@ -169,4 +174,4 @@ export async function triggerAction({ } finally { invalidateTriggerId(triggerId); } -} +} \ No newline at end of file