@devries-cameron20 / t3code Mirror · read-only / commits / de025aa69f
Fork 0

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, 11:30 UTC

fix(mobile): show loading and syncing in the working pill (#9466)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Julius Marminge committed Sep 3, 2026 at 12:52 UTC de025aa69ffb0ce1a45d30aed25c60454660b62d
4 files changed +60 -44
apps/mobile/src/features/threads/ThreadComposer.tsx
+2 -22
@@ -110,12 +110,6 @@ export interface ThreadComposerProps {
110 readonly connectionState: RemoteClientConnectionState;
111 readonly connectionError: string | null;
112 readonly environmentLabel: string | null;
113 - /**
114 - * Message sync phase for the selected thread (drives the status pill):
115 - * "loading" = first fetch, nothing to show yet; "syncing" = cached messages
116 - * are on screen while they reconcile with the server.
117 - */
118 - readonly threadSyncPhase?: "loading" | "syncing" | null;
113 readonly selectedThread: OrchestrationThreadShell;
114 readonly serverConfig: T3ServerConfig | null;
115 readonly queueCount: number;
@@ -225,7 +219,7 @@ export function ComposerSurface(props: {
219 }
220
221 type ComposerStatusPillState = {
228 - readonly kind: "unavailable" | "reconnecting" | "syncing";
222 + readonly kind: "unavailable" | "reconnecting";
223 readonly label: string;
224 };
225
@@ -233,7 +227,6 @@ function composerConnectionStatus(input: {
227 readonly connectionError: string | null;
228 readonly connectionState: RemoteClientConnectionState;
229 readonly environmentLabel: string | null;
236 - readonly threadSyncPhase?: "loading" | "syncing" | null;
230 }): ComposerStatusPillState | null {
231 const environmentLabel = input.environmentLabel ?? "Environment";
232
@@ -259,18 +252,6 @@ function composerConnectionStatus(input: {
252 case "available":
253 return { kind: "unavailable", label: `${environmentLabel} is not connected` };
254 case "connected":
262 - break;
263 - }
264 -
265 - // Connected: the pill is the single loading/sync indicator. One stable
266 - // label per open — "Loading" when starting from scratch, "Syncing" when
267 - // cached messages are already visible.
268 - switch (input.threadSyncPhase) {
269 - case "loading":
270 - return { kind: "syncing", label: "Loading messages..." };
271 - case "syncing":
272 - return { kind: "syncing", label: "Syncing messages..." };
273 - default:
255 return null;
256 }
257 }
@@ -279,7 +260,7 @@ const ComposerConnectionStatusPill = memo(function ComposerConnectionStatusPill(
260 readonly onPress: () => void;
261 readonly status: ComposerStatusPillState;
262 }) {
282 - const isReconnecting = props.status.kind !== "unavailable";
263 + const isReconnecting = props.status.kind === "reconnecting";
264 return (
265 <Animated.View
266 className="absolute inset-x-0 bottom-full items-center pb-2"
@@ -344,7 +325,6 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
325 connectionError: props.connectionError,
326 connectionState: props.connectionState,
327 environmentLabel: props.environmentLabel,
347 - threadSyncPhase: props.threadSyncPhase,
328 });
329 const selectedProviderStatus = useMemo(() => {
330 if (!props.serverConfig) return null;
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+24 -13
@@ -74,6 +74,7 @@ import { PendingUserInputCard } from "./PendingUserInputCard";
74 import {
75 FLOATING_WORKING_CONTROL_COVERAGE,
76 FloatingWorkingControl,
77 + type FloatingWorkingStatus,
78 } from "./floating-working-control";
79 import {
80 derivePendingUserInputMaxHeight,
@@ -301,27 +302,38 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
302 // The raw sync status enters "synchronizing" on every full fetch, cached or
303 // not. Whether messages are already on screen decides the pill label: no
304 // data yet → "Loading messages", cached data reconciling → "Syncing".
304 - const threadSyncPhase = (() => {
305 + const threadSyncLabel = (() => {
306 switch (props.threadSyncStatus) {
307 case "empty":
308 case "cached":
309 case "synchronizing":
310 if (contentPresentationKind === "ready") {
310 - return "syncing" as const;
311 + return "Syncing messages...";
312 }
312 - return contentPresentationKind === "loading" ? ("loading" as const) : null;
313 + return contentPresentationKind === "loading" ? "Loading messages..." : null;
314 default:
315 return null;
316 }
317 })();
317 - const showWorkingControl =
318 - props.activeWorkStartedAt !== null &&
319 - contentPresentationKind === "ready" &&
320 - threadSyncPhase === null &&
321 - props.connectionStateLabel === "connected" &&
322 - props.activePendingApproval === null &&
323 - props.activePendingUserInput === null;
324 - const floatingWorkingStartedAt = showWorkingControl ? props.activeWorkStartedAt : null;
318 + // One floating pill above the composer: it reads the sync state while
319 + // messages load, then the working timer once the feed is settled.
320 + const floatingStatus = ((): FloatingWorkingStatus | null => {
321 + if (
322 + props.connectionStateLabel !== "connected" ||
323 + props.activePendingApproval !== null ||
324 + props.activePendingUserInput !== null
325 + ) {
326 + return null;
327 + }
328 + if (threadSyncLabel !== null) {
329 + return { kind: "syncing", label: threadSyncLabel };
330 + }
331 + if (props.activeWorkStartedAt !== null && contentPresentationKind === "ready") {
332 + return { kind: "working", startedAt: props.activeWorkStartedAt };
333 + }
334 + return null;
335 + })();
336 + const showWorkingControl = floatingStatus !== null;
337 const selectedThreadFeed = props.selectedThreadFeed;
338 const composerChrome = composerExpanded ? COMPOSER_EXPANDED_CHROME : COMPOSER_COLLAPSED_CHROME;
339 const composerOverlapHeight = composerChrome + composerBottomInset;
@@ -748,7 +760,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
760 <View ref={composerOverlayRef} onLayout={onComposerLayout} className="w-full">
761 <FloatingWorkingControl
762 colorScheme={isDarkMode ? "dark" : "light"}
751 - startedAt={floatingWorkingStartedAt}
763 + status={floatingStatus}
764 showScrollToEnd={showScrollToEndButton}
765 onScrollToEnd={handleScrollToEnd}
766 />
@@ -807,7 +819,6 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
819 connectionState={props.connectionStateLabel}
820 connectionError={props.connectionError}
821 environmentLabel={props.environmentLabel}
810 - threadSyncPhase={threadSyncPhase}
822 selectedThread={props.selectedThread}
823 serverConfig={props.serverConfig}
824 queueCount={props.selectedThreadQueueCount}
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+3 -2
@@ -157,8 +157,9 @@ export function ThreadRouteScreen(props: ThreadRouteScreenProps) {
157
158 // Render the full thread chrome (header, feed, composer) as soon as the
159 // thread SHELL is known — no blocking on message detail. The feed shows a
160 - // loading placeholder while messages fetch, and the composer's connection
161 - // pill reports connecting/reconnecting/syncing status.
160 + // loading placeholder while messages fetch, the floating pill above the
161 + // composer reports loading/syncing, and the composer's connection pill
162 + // reports connecting/reconnecting status.
163 if (selectedThread !== null && selectedThreadKey === routeThreadKey) {
164 return <ThreadRouteContent {...props} selectedThreadDetailState={selectedThreadDetailState} />;
165 }
apps/mobile/src/features/threads/floating-working-control.tsx
+31 -7
@@ -1,6 +1,6 @@
1 import { GlassContainer, GlassView } from "expo-glass-effect";
2 import { useEffect, useState } from "react";
3 -import { Text as SystemText, View } from "react-native";
3 +import { ActivityIndicator, Text as SystemText, View } from "react-native";
4 import Animated, {
5 Easing,
6 FadeIn,
@@ -40,9 +40,17 @@ const AnimatedGlassView = Animated.createAnimatedComponent(UniwindGlassView);
40
41 export const FLOATING_WORKING_CONTROL_COVERAGE = CONTROL_HEIGHT + CONTROL_COMPOSER_GAP;
42
43 +/**
44 + * What the floating pill says. Syncing and working share one element so the
45 + * label swaps in place instead of one pill fading out for another.
46 + */
47 +export type FloatingWorkingStatus =
48 + | { readonly kind: "working"; readonly startedAt: string }
49 + | { readonly kind: "syncing"; readonly label: string };
50 +
51 export function FloatingWorkingControl(props: {
52 readonly colorScheme: "light" | "dark";
45 - readonly startedAt: string | null;
53 + readonly status: FloatingWorkingStatus | null;
54 readonly showScrollToEnd: boolean;
55 readonly onScrollToEnd: () => void;
56 }) {
@@ -62,7 +70,7 @@ export function FloatingWorkingControl(props: {
70 opacity: separationProgress.value,
71 }));
72
65 - if (props.startedAt === null && !props.showScrollToEnd) {
73 + if (props.status === null && !props.showScrollToEnd) {
74 return null;
75 }
76
@@ -74,7 +82,7 @@ export function FloatingWorkingControl(props: {
82 entering={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : CONTROL_ENTERING}
83 exiting={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : CONTROL_EXITING}
84 >
77 - {props.startedAt !== null && NATIVE_LIQUID_GLASS_SUPPORTED ? (
85 + {props.status !== null && NATIVE_LIQUID_GLASS_SUPPORTED ? (
86 <UniwindGlassContainer
87 spacing={GLASS_MERGE_SPACING}
88 pointerEvents="box-none"
@@ -87,7 +95,7 @@ export function FloatingWorkingControl(props: {
95 className="h-11 justify-center overflow-hidden rounded-full"
96 style={timerStyle}
97 >
90 - <WorkingDuration startedAt={props.startedAt} />
98 + <FloatingStatusLabel status={props.status} />
99 </AnimatedGlassView>
100
101 <AnimatedGlassView
@@ -105,14 +113,14 @@ export function FloatingWorkingControl(props: {
113 </Animated.View>
114 </AnimatedGlassView>
115 </UniwindGlassContainer>
108 - ) : props.startedAt !== null ? (
116 + ) : props.status !== null ? (
117 <View pointerEvents="box-none" className="flex-row items-center gap-4">
118 <Animated.View
119 pointerEvents="none"
120 className="h-11 justify-center rounded-full border border-border bg-card shadow-md shadow-black/10"
121 style={timerStyle}
122 >
115 - <WorkingDuration startedAt={props.startedAt} />
123 + <FloatingStatusLabel status={props.status} />
124 </Animated.View>
125
126 <Animated.View
@@ -153,6 +161,22 @@ export function FloatingWorkingControl(props: {
161 );
162 }
163
164 +function FloatingStatusLabel(props: { readonly status: FloatingWorkingStatus }) {
165 + if (props.status.kind === "syncing") {
166 + return (
167 + <View
168 + accessible
169 + accessibilityLabel={props.status.label}
170 + className="h-11 flex-row items-center gap-2 px-4"
171 + >
172 + <ActivityIndicator size="small" colorClassName="accent-icon-muted" />
173 + <Text className="font-t3-medium text-xs text-foreground">{props.status.label}</Text>
174 + </View>
175 + );
176 + }
177 + return <WorkingDuration startedAt={props.status.startedAt} />;
178 +}
179 +
180 function WorkingDuration(props: { readonly startedAt: string }) {
181 const [nowMs, setNowMs] = useState(() => Date.now());
182