The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): expanded tool-call groups keep following new calls (#15747)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
nekohasekai committed
Oct 20, 2026 at 01:37 UTC
e5d6a092b0ba845292e14dc3b3dc6484447b18f7
1 file changed
+10
-11
apps/mobile/src/features/threads/thread-work-log.tsx
+10
-11
@@ -22,6 +22,7 @@ import { AnimatedLegendList } from "@legendapp/list/reanimated";
22
import { StackActions, useIsFocused, useNavigation } from "@react-navigation/native";
23
import {
24
useEffect,
25
+ useEffectEvent,
26
useId,
27
useLayoutEffect,
28
useRef,
@@ -624,7 +625,9 @@ function ThreadWorkGroupList(props: {
625
void listRef.current?.scrollToEnd({ animated: false });
626
}
627
};
627
- const onContentSizeChange = (nextHeight: number) => {
628
+ // LegendList notifies from child layout effects. Effect Events see the
629
+ // committed rows before those effects run, unlike a parent layout-effect ref.
630
+ const onContentSizeChange = useEffectEvent((nextHeight: number) => {
631
const previous = previousContent.current;
632
const detailsChanged = previous.expandedRows !== props.expandedRows;
633
const followAppend =
@@ -658,25 +661,21 @@ function ThreadWorkGroupList(props: {
661
}
662
finishPendingAppend();
663
rememberPosition();
661
- };
664
+ });
665
// The native ScrollView reports its content size a frame or more after
666
// LegendList has laid the rows out, so a detail toggle rendered the group
667
// at its old height while the rows below already moved. Read the size
668
// LegendList computes on the JS thread instead; it settles in the same
669
// commit as the row measurement that changed it.
667
- const onContentSizeChangeRef = useRef(onContentSizeChange);
670
useLayoutEffect(() => {
669
- onContentSizeChangeRef.current = onContentSizeChange;
670
- }, [onContentSizeChange]);
671
- const subscribeToContentSize = (list: LegendListRef | null) => {
672
- listRef.current = list;
671
+ const list = listRef.current;
672
if (!list) return;
673
const unsubscribe = list.getState().listen("totalSize", () => {
675
- onContentSizeChangeRef.current(list.getState().contentLength);
674
+ onContentSizeChange(list.getState().contentLength);
675
});
677
- onContentSizeChangeRef.current(list.getState().contentLength);
676
+ onContentSizeChange(list.getState().contentLength);
677
return unsubscribe;
679
- };
678
+ }, []);
679
const getFixedItemSize = (row: ThreadFeedActivity, index: number) =>
680
props.expandedRows[row.id] || props.rowSizing.fixedRowHeight === undefined
681
? undefined
@@ -690,7 +689,7 @@ function ThreadWorkGroupList(props: {
689
return (
690
<View style={{ height, overflow: "hidden" }}>
691
<AnimatedLegendList
693
- ref={subscribeToContentSize}
692
+ ref={listRef}
693
data={props.activities}
694
keyExtractor={workLogRowKey}
695
estimatedItemSize={props.rowSizing.estimatedRowHeight + WORK_ROW_GAP}