Skip to content

fix(sentry): pass a string title to every alert dialog - #1140

Merged
devi-r merged 1 commit into
developfrom
fix/alert-dialog-non-string-title
Aug 24, 2026
Merged

devi-r merged 1 commit into
developfrom
fix/alert-dialog-non-string-title

Conversation

@devi-r

@devi-r devi-r commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Opening a file attachment that no installed app can handle rejects with an error object, and FileBubble passed that object straight into Alert.alert as the title. Alert forwards its arguments across the bridge untouched, so Android's DialogModule read the title as a string, failed the cast, and killed the process. It accounts for 2.2K events across 90 users.

Give both preview failures a real title and render the error as the message. ConversationActions had the same shape via an as Error cast that produced an undefined title when a share rejected with anything other than an Error, so it moves to the same helper.

Fixes CHATWOOT-MOBILE-C0.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents React Native Alert.alert crashes on Android by ensuring alert titles/messages are always strings when displaying caught/rejected errors (notably from native module rejections and sharing/preview flows).

Changes:

  • Added errorMessage(error: unknown): string helper to safely coerce thrown/rejected values into a displayable string.
  • Updated ConversationActions to always pass a string title and a string message to Alert.alert on share failures.
  • Updated FileBubblePreview to always pass a string title and a string message to Alert.alert on preview failures, and added unit tests for errorMessage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/utils/specs/errorUtils.spec.ts Adds test coverage for errorMessage across common error/rejection shapes.
src/utils/errorUtils.ts Introduces errorMessage helper with safe fallback to i18n.t('COMMON.ERROR').
src/screens/chat-screen/conversation-actions/ConversationActions.tsx Uses errorMessage and a string title to avoid invalid alert arguments from share failures.
src/screens/chat-screen/components/message-components/FileBubble.tsx Uses errorMessage to avoid passing non-strings into Alert.alert during file preview failures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@devi-r
devi-r merged commit fac3406 into develop Aug 24, 2026
3 checks passed
@devi-r
devi-r deleted the fix/alert-dialog-non-string-title branch August 24, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants