UIKit modal: a viewSubmit response with no `type` field fails to close the modal on mobile (regression from #7057)

Abierto Apto para principiantes
#7,503 3 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@erikurt9 ya está trabajando en esto.

Desde el 1/8/2026.

  • #7537 de @erikurt9 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
react-native, typescript
Área
mobile

Línea de trabajo

Lee app/lib/methods/actions.ts y app/containers/UIKit/interactionAdapters.ts, y luego sigue triggerSubmitView en app/lib/methods/triggerActions.ts. Verifica que una respuesta exitosa sin type se gestione como modal.close, mientras que las cadenas de type desconocidas sigan fallando, y confirma que el modal se cierra con la respuesta de éxito simple documentada en dispositivos móviles.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

type: bug

When a Rocket.Chat App responds to a viewSubmit UIKit interaction with a bare
success response ({ "success": true }, no type field — this is what
apps-engine's UIKitInteractionResponder.successResponse() produces, and is a
documented valid response shape for "done, nothing more to render"), the modal
fails to close on the mobile app. No error is shown to the user; the submit
spinner simply stops and the form stays open.

This worked correctly before PR #7057 ("feat: Voice message blocks"), and still
works correctly on the desktop/web client.

Steps to reproduce
  1. Build (or use) a Rocket.Chat App that opens a UIKit modal (e.g. via a slash
    command) and, on viewSubmit, returns
    context.getInteractionResponder().successResponse().
  2. Open the modal on the mobile app and tap Submit.

Expected: the modal closes, same as it does on desktop/web.
Actual: the modal stays open. Nothing is shown to the user — no error, no
update — the loading indicator just clears.

Root cause

In app/lib/methods/actions.ts, triggerAction() parses the response body and
does:

const { type: interactionType, ...data } = parsed;
const modalType = toServerModalInteractionType(interactionType ?? '');
if (!modalType) {
throw new Error(Unknown modal interaction type: ${interactionType ?? 'undefined'});
}

toServerModalInteractionType (app/containers/UIKit/interactionAdapters.ts) is
a strict allow-list of 'modal.open' | 'modal.update' | 'modal.close' | 'errors'.
A bare { success: true } response has interactionType === undefined, so
toServerModalInteractionType('') returns null, and the code above throws.

That exception propagates out of triggerAction, through triggerSubmitView
(app/lib/methods/triggerActions.ts), which has no try/catch of its own — so
its Navigation.back() call (gated on triggerAction's resolved value) is
never reached. The exception is only caught by ModalBlockView.submit()'s
outer catch (e) { /* do nothing */ }, which swallows it silently.

Before #7057, triggerAction/handlePayloadUserInteraction treated any
unrecognized or missing type as an implicit ModalActions.CLOSE by fallthrough
(no allow-list, no throw), so this exact response used to close the modal.

Cancel is unaffected because ModalBlockView.cancel() calls Navigation.back()
unconditionally before making the network call, so the same exception (thrown
inside triggerCancel → triggerAction) no longer matters by the time it fires.

Web is unaffected because ActionManager.emitInteraction's finally block
closes the view on any response type outside an exclusion list
(errors/modal.update/contextual_bar.update), rather than requiring the
type to be on an allow-list.

Proposed fix

In triggerAction, treat a successful response with no type field as an
explicit modal.close before consulting the allow-list, instead of throwing:

const { type: interactionType, ...data } = parsed;
if (interactionType === undefined) {
return ModalActions.CLOSE;
}
const modalType = toServerModalInteractionType(interactionType);
if (!modalType) {
throw new Error(Unknown modal interaction type: ${interactionType});
}

This restores the old behavior for the specific case that regressed, without
weakening the throw for a genuinely unrecognized type string.

Environment

  • Rocket.Chat.ReactNative: develop (reproduced against a build including PR #7057)
  • Rocket.Chat Server: 8.6.0
  • Platform: Android v15 (code path is platform-independent, likely affects iOS too)
  • Apps-Engine version: 1.64.0
Lenguaje dominante
TypeScript
Estrellas
2.4k
Forks
1.5k
Merge medio
1 d 15 h
PR fusionados (30 d)
29

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RocketChat/Rocket.Chat.ReactNative

Todos los issues de RocketChat/Rocket.Chat.ReactNative

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.