Skip to content

[Bug]: Android app crashes at using thread search #5250

Description

@fgonzalezurriola

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. Open app
  2. Use thread search with at least 2 characters
  3. App crashes and goes blank

Expected behavior

Functional behavior

Actual behavior

Crash on thread search usage

Impact

Major degradation or frequent failure

Version or commit

1.0.1 android version

Environment

Android 16

Logs or stack traces

CLANKER DIAGNOSTIC (sounds plausible - this is GPT 5.6 Sol on low reasoning):

The Android production app crashes to a blank screen when the thread search query reaches two characters. For example, entering `p` works and can show local title matches, but entering `pi` causes the UI to go blank after the search debounce. The failure is reproducible on T3 Code Android 1.0.1.

ADB logcat captures the following error at the moment the second character is entered:


ReactNativeJS: TypeError: undefined is not a function
componentStack:
  at HomeScreen


The cause appears to be `makeThreadSearchKey()` in `packages/client-runtime/src/state/threadSearch.ts`, which calls `Array.prototype.toSorted()`. The Android build runs on Hermes, where this ES2023 method is unavailable. One-character queries do not trigger the failure because remote thread-content search requires at least two characters. Once that threshold is reached, `useThreadSearch()` calls `makeThreadSearchKey()` and the unhandled render-time exception leaves the app on a blank screen.

The repository already avoids `toSorted()` elsewhere in mobile code, with a comment explaining that Hermes does not provide the ES2023 change-by-copy array methods. Replacing this call with a copied mutable sort, such as `[...environmentIds].sort(compare)`, should prevent the crash. A regression test should also run this path with `Array.prototype.toSorted` unavailable, since the existing tests pass under Node/V8 and therefore do not expose the Android runtime incompatibility.

Screenshots, recordings, or supporting files

Screenrecorder-2026-08-02-19-48-30-743.mp4

Workaround

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions