Skip to content

fix(mobile): prevent Android thread search crash - #5386

Merged
shivamhwp merged 1 commit into
pingdotgg:mainfrom
shivamhwp:fix/android-thread-search-hermes
Aug 5, 2026
Merged

fix(mobile): prevent Android thread search crash#5386
shivamhwp merged 1 commit into
pingdotgg:mainfrom
shivamhwp:fix/android-thread-search-hermes

Conversation

@shivamhwp

@shivamhwp shivamhwp commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Fixes #5250.

Android thread search crashes as soon as a query reaches two characters because content search builds its cache key with Array.prototype.toSorted(), which Hermes does not provide. The resulting render-time exception blanks the home screen.

Use a copied mutable sort instead, preserving the stable key and leaving the input array untouched. Add a regression test that removes toSorted from the runtime so this compatibility path stays covered.

Android verification

Before — two-character search blanks the screen After — two-character search stays rendered
Before fix: Android app blank after a two-character thread search After fix: Android app shows matching threads after a two-character thread search

Verification:

  • vp test run packages/client-runtime/src/state/threadSearch.test.ts
  • vp fmt --check packages/client-runtime/src/state/threadSearch.ts packages/client-runtime/src/state/threadSearch.test.ts
  • vp lint packages/client-runtime/src/state/threadSearch.ts packages/client-runtime/src/state/threadSearch.test.ts
  • vp run typecheck in packages/client-runtime
  • Physical Android 16 device: one- and two-character searches remain rendered; no React Native exception in logcat

Generated with GPT-5.6-Sol through the Codex harness in T3 Code.


Note

Low Risk
Small, localized change to cache-key construction with an added test; behavior is intended to match the previous stable key format.

Overview
Fixes Android thread search crashing once queries reach two characters, when Hermes throws because Array.prototype.toSorted is missing.

makeThreadSearchKey now copies environment IDs and uses .sort() on that copy so cache keys stay order-stable without mutating the caller’s array. A regression test strips toSorted from the prototype to lock in Hermes-compatible behavior.

Reviewed by Cursor Bugbot for commit 3ed9d0f. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix makeThreadSearchKey crash on Android by replacing toSorted with sort

The Hermes JavaScript engine used on Android does not support Array.prototype.toSorted, causing a crash in thread search. threadSearch.ts is updated to spread-copy the environment IDs array and call .sort() instead, achieving the same deterministic key output without relying on the unavailable method. A Jest test is added that removes toSorted from Array.prototype to verify the fallback behavior.

Macroscope summarized 3ed9d0f.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 035a982d-68f4-4475-83da-d7f240563cb1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 5, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 52d39c8

Straightforward bug fix replacing ES2023 toSorted() (unavailable in Hermes/React Native) with equivalent sort() on an already-copied array. No behavioral change beyond fixing the Android crash. Test coverage added.

You can customize Macroscope's approvability policy. Learn more.

@shivamhwp
shivamhwp force-pushed the fix/android-thread-search-hermes branch from 52d39c8 to 3ed9d0f Compare August 5, 2026 05:49
@shivamhwp
shivamhwp merged commit 70de6e1 into pingdotgg:main Aug 5, 2026
15 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 5, 2026
## What's Changed
* fix(mcp): unblock Kimi models in OpenCode with preview tools by @hwanseoc in pingdotgg/t3code#5128
* fix(web): clear main branch lint warnings by @t3dotgg in pingdotgg/t3code#5384
* fix(mobile): preserve grouped project workspaces by @shivamhwp in pingdotgg/t3code#4642
* fix(mobile): prevent Android thread search crash by @shivamhwp in pingdotgg/t3code#5386
* fix(web): truncate long project switcher names by @FllipEis in pingdotgg/t3code#5348
* fix(mobile): avoid double dividers between thread sections by @shivamhwp in pingdotgg/t3code#5391
* fix(web): keep the composer command menu anchored to the composer by @StiensWout in pingdotgg/t3code#5336
* fix(web): restore terminal link hover styles by @StiensWout in pingdotgg/t3code#5382
* fix(ci): isolate releases from shared API rate limits by @t3dotgg in pingdotgg/t3code#5394


**Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260805.1002...v0.0.32-nightly.20260805.1005

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260805.1005
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
vortechron pushed a commit to vortechron/void that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Android app crashes at using thread search

1 participant