Skip to content
TypeScript

fix(mobile): preserve chat rows when toggling commands (#10492)

Julius Marmingedc39615aec70
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index 503077bbc2e..c4f8eea9275 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -210,6 +210,7 @@ function formatMessageTime(input: string): string {
// text fits at the current font settings. Larger accessibility text is measured.
const TURN_FOLD_HEIGHT = 42; // min-h-11 (38.5) + mb-1 (3.5), with the mobile 14px rem
const THREAD_FEED_LAYOUT_TRANSITION = LinearTransition.duration(THREAD_DISCLOSURE_TRANSITION_MS);
+const THREAD_FEED_IMMEDIATE_TRANSITION = LinearTransition.duration(0);
// Tailwind spacing on the mobile 14px rem: px-3.5 on the user bubble, px-1 on
// assistant rows. Images size their frame from these before their own layout.
const USER_BUBBLE_HORIZONTAL_PADDING = 3.5 * 3.5;
@@ -2865,8 +2866,13 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
entry.type === "message" ? `message:${entry.message.role}` : entry.type
}
getFixedItemSize={getFixedItemSize}
+ // LegendList swaps its position and size component types when this
+ // becomes undefined, remounting the feed and replaying row entrances.
+ // Keep those containers mounted while ordinary updates stay immediate.
itemLayoutAnimation={
- disclosureToggleSettling ? THREAD_FEED_LAYOUT_TRANSITION : undefined
+ disclosureToggleSettling
+ ? THREAD_FEED_LAYOUT_TRANSITION
+ : THREAD_FEED_IMMEDIATE_TRANSITION
}
onItemSizeChanged={handleItemSizeChanged}
// Measure rows well before they scroll into view so estimate→actual