The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 02:45 UTC
fix(mobile): prevent Hermes crashes when opening threads (#11233)
Jake Leventhal committed
Sep 11, 2026 at 12:01 UTC
2ebc9fa4ed24e389eef24039f27c73ae6633858f
3 files changed
+21
-3
apps/mobile/src/lib/threadActivity.test.ts
+16
-1
@@ -1,5 +1,5 @@
1
import { derivePendingRequests } from "@t3tools/client-runtime/pending-requests";
2
-import { describe, expect, it } from "vite-plus/test";
2
+import { beforeEach, describe, expect, it } from "vite-plus/test";
3
4
import {
5
ApprovalRequestId,
@@ -27,6 +27,21 @@ import {
27
type WorkLogEntry,
28
} from "./threadActivity";
29
30
+// Match Hermes: these ES2023 array methods are absent on mobile.
31
+beforeEach(() => {
32
+ const methods = ["toSorted", "toReversed"] as const;
33
+ const descriptors = methods.map((method) =>
34
+ Object.getOwnPropertyDescriptor(Array.prototype, method),
35
+ );
36
+ for (const method of methods) Reflect.deleteProperty(Array.prototype, method);
37
+ return () => {
38
+ for (const [index, method] of methods.entries()) {
39
+ const descriptor = descriptors[index];
40
+ if (descriptor) Reflect.defineProperty(Array.prototype, method, descriptor);
41
+ }
42
+ };
43
+});
44
+
45
const singleSelectQuestion = {
46
id: "runtime",
47
header: "Runtime",
packages/client-runtime/src/work-log/presentation.ts
+3
-1
@@ -658,7 +658,9 @@ export function omitSupersededLifecycleMarkers<T>(
658
}
659
}
660
661
- return reversedEntries.toReversed();
661
+ // Hermes lacks toReversed; this array is local, so reversing it cannot mutate the input.
662
+ // oxlint-disable-next-line unicorn/no-array-reverse
663
+ return reversedEntries.reverse();
664
}
665
666
export function toolGroupSummaryKind(
packages/client-runtime/src/work-log/userInput.ts
+2
-1
@@ -27,8 +27,9 @@ function questionFingerprint(
27
questions: ReadonlyArray<unknown>,
28
): string | undefined {
29
const texts = questions.map((question) => (typeof question === "string" ? question.trim() : ""));
30
+ // Sort the fresh array in place because Hermes does not provide toSorted.
31
return texts.length > 0 && texts.every(Boolean)
31
- ? JSON.stringify([turnId, texts.toSorted()])
32
+ ? JSON.stringify([turnId, texts.sort()])
33
: undefined;
34
}
35