Skip to content

Commit 4962aaf

Browse files
Fix queued-row env label gate and stale project props
Two review findings on the v2 queued row: The row always printed the environment label, while v2 thread rows only print it when more than one environment is connected. On a single machine the queued rows named it and the live rows above them did not, which is exactly the inconsistency the label gate exists to avoid. Project shells load after the first rows draw, but the lists' extraData omitted the maps those shells feed, so a recycled row kept the blank favicon and fallback title it first rendered with. Pass projectByKey, projectCwdByKey, and projectTitleByProjectKey through extraData on both the Home v2 list and the sidebar so late-arriving project metadata re-renders the rows that display it. Co-Authored-By: Claude <[email protected]>
1 parent bccd702 commit 4962aaf

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

‎apps/mobile/src/features/home/HomeScreen.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,10 @@ export function HomeScreen(props: HomeScreenProps) {
592592
project={projectByKey.get(pendingScopeKey) ?? null}
593593
projectTitle={v2ProjectTitleByProjectKey.get(pendingScopeKey)}
594594
environmentLabel={
595-
props.savedConnectionsById[item.pendingTask.message.environmentId]
596-
?.environmentLabel ?? null
595+
Object.keys(props.savedConnectionsById).length > 1
596+
? (props.savedConnectionsById[item.pendingTask.message.environmentId]
597+
?.environmentLabel ?? null)
598+
: null
597599
}
598600
showPendingDivider={item.showPendingDivider}
599601
onSelectPendingTask={props.onSelectPendingTask}
@@ -900,6 +902,8 @@ export function HomeScreen(props: HomeScreenProps) {
900902
keyExtractor={v2KeyExtractor}
901903
extraData={{
902904
projectByKey,
905+
projectCwdByKey,
906+
projectTitleByProjectKey: v2ProjectTitleByProjectKey,
903907
serverConfigs,
904908
savedConnectionsById: props.savedConnectionsById,
905909
}}

‎apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,13 +676,26 @@ function ThreadNavigationSidebarPane(
676676
onScroll: handleScroll,
677677
onScrollBeginDrag: handleScrollBeginDrag,
678678
});
679+
// Project shells load after the first rows draw, so the maps they feed have
680+
// to bust the recycler's memoization — otherwise a row keeps the blank
681+
// favicon and fallback title it was first rendered with.
679682
const listExtraData = useMemo(
680683
() => ({
681684
selectedThreadKey: props.selectedThreadKey ?? "",
685+
projectByKey,
686+
projectCwdByKey,
687+
projectTitleByProjectKey,
682688
savedConnectionsById,
683689
serverConfigs,
684690
}),
685-
[props.selectedThreadKey, savedConnectionsById, serverConfigs],
691+
[
692+
props.selectedThreadKey,
693+
projectByKey,
694+
projectCwdByKey,
695+
projectTitleByProjectKey,
696+
savedConnectionsById,
697+
serverConfigs,
698+
],
686699
);
687700
const sidebarItemsAreEqual = useCallback(
688701
(previous: SidebarListItem, item: SidebarListItem): boolean => {
@@ -748,8 +761,10 @@ function ThreadNavigationSidebarPane(
748761
project={projectByKey.get(pendingScopeKey) ?? null}
749762
projectTitle={projectTitleByProjectKey.get(pendingScopeKey)}
750763
environmentLabel={
751-
savedConnectionsById[item.pendingTask.message.environmentId]?.environmentLabel ??
752-
null
764+
Object.keys(savedConnectionsById).length > 1
765+
? (savedConnectionsById[item.pendingTask.message.environmentId]
766+
?.environmentLabel ?? null)
767+
: null
753768
}
754769
pane="sidebar"
755770
showPendingDivider={item.showPendingDivider}

0 commit comments

Comments
 (0)