fix(mobile): support Hermes collection sorting

Reuses the focused compatibility approach from closed PR #3923 and covers the remaining hardware-keyboard reverse iteration.

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex committed 2026-08-14 11:23:26 +02:00
1 parent 9c65560b35
commit 32b749d07e
8 files changed
+72 -22

No files matched your search

@@ -55,7 +55,10 @@ export function subscribeToHardwareKeyboardCommandRegistrations(listener: () =>
export function dispatchHardwareKeyboardCommand(command: HardwareKeyboardCommand): boolean {
const commandHandlers = handlers.get(command);
if (!commandHandlers) return false;
for (const handler of [...commandHandlers].toReversed()) {
const handlersInRegistrationOrder = Array.from(commandHandlers);
for (let index = handlersInRegistrationOrder.length - 1; index >= 0; index -= 1) {
const handler = handlersInRegistrationOrder[index];
if (!handler) continue;
if (handler() !== false) return true;
}
return false;
@@ -8,7 +8,8 @@ import {
} from "@t3tools/client-runtime/state/thread-relationships";
import { canDetachThreadProviderSession } from "@t3tools/client-runtime/state/thread-workflows";
import type { EnvironmentId, OrchestrationV2ThreadShell, ThreadId } from "@t3tools/contracts";
import { useRouter } from "expo-router";
import { copySorted } from "@t3tools/shared/Array";
import { useNavigation } from "@react-navigation/native";
import { useMemo, useState } from "react";
import { ActivityIndicator, Modal, Pressable, ScrollView, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -79,7 +80,8 @@ export function ThreadRelationshipsBanner(props: {
const mergeTargetThreadId = resolveMergeBackTargetThreadId(projection);
const rows = useMemo(
() =>
immediateThreadRelationships(graph, props.threadId).toSorted(
copySorted(
immediateThreadRelationships(graph, props.threadId),
(left, right) =>
Number(right.threadId === mergeTargetThreadId) -
Number(left.threadId === mergeTargetThreadId),
+16 -2
View File
@@ -9,6 +9,7 @@ import {
} from "@t3tools/contracts";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import * as Option from "effect/Option";
import { copySorted } from "@t3tools/shared/Array";
import { useProject, useThreadShell } from "../state/entities";
import { useEnvironmentThread } from "../state/threads";
@@ -44,8 +45,21 @@ function threadDetailToShell(
environmentId: EnvironmentId,
thread: OrchestrationThread,
): EnvironmentThreadShell {
return {
environmentId,
const thread = projection.thread;
const runsByOrdinal = copySorted(projection.runs, (left, right) => right.ordinal - left.ordinal);
const latestRun = runsByOrdinal[0] ?? null;
const activeRun =
runsByOrdinal.find(
(run) =>
run.status === "preparing" ||
run.status === "queued" ||
run.status === "starting" ||
run.status === "running" ||
run.status === "waiting",
) ?? null;
const pendingRequest =
projection.runtimeRequests.find((request) => request.status === "pending") ?? null;
return presentThreadShell(environmentId, {
id: thread.id,
projectId: thread.projectId,
title: thread.title,