diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx
index a43cc05513..4b97b8f759 100644
--- a/apps/mobile/src/features/home/HomeScreen.tsx
+++ b/apps/mobile/src/features/home/HomeScreen.tsx
@@ -249,7 +249,11 @@ export function HomeScreen(props: HomeScreenProps) {
isFirst={item.isFirst}
groupKey={item.group.key}
onGroupAction={updateGroupDisplay}
- onNewThread={props.onNewThreadInProject}
+ // Aggregated groups (same repo across machines) have no single
+ // target project, so the quick new-thread button is single-project only.
+ onNewThread={
+ item.group.projects.length === 1 ? props.onNewThreadInProject : undefined
+ }
project={item.group.representative}
threadCount={item.group.threads.length + item.group.pendingTasks.length}
title={item.group.title}
diff --git a/apps/mobile/src/features/home/homeListItems.test.ts b/apps/mobile/src/features/home/homeListItems.test.ts
index 12b0a3248f..c964453a6d 100644
--- a/apps/mobile/src/features/home/homeListItems.test.ts
+++ b/apps/mobile/src/features/home/homeListItems.test.ts
@@ -157,6 +157,47 @@ describe("buildHomeListLayout", () => {
expect(reset.visibleCount).toBe(HOME_INITIAL_VISIBLE_THREADS);
});
+ it("offers show-less after expanding a stale group whose baseline is below the page size", () => {
+ // Stale project: 10 threads total but only 3 within the recency window.
+ const project = makeProject("stale", "stale");
+ const threads = Array.from({ length: 10 }, (_, index) =>
+ makeThread(`stale-thread-${index}`, project.id),
+ );
+ const group: HomeThreadGroup = {
+ key: "stale",
+ title: "stale",
+ representative: project,
+ projects: [project],
+ pendingTasks: [],
+ threads,
+ recentThreads: threads.slice(0, 3),
+ };
+
+ const collapsedToRecent = buildHomeListLayout({
+ groups: [group],
+ displayStates: displayStates({}),
+ });
+ expect(collapsedToRecent.items.filter((item) => item.type === "thread")).toHaveLength(3);
+ expect(collapsedToRecent.items.at(-1)).toMatchObject({
+ type: "show-more",
+ hiddenCount: 7,
+ canShowLess: false,
+ });
+
+ const expanded = buildHomeListLayout({
+ groups: [group],
+ displayStates: displayStates({
+ stale: nextGroupDisplayState(DEFAULT_GROUP_DISPLAY_STATE, "show-more"),
+ }),
+ });
+ expect(expanded.items.filter((item) => item.type === "thread")).toHaveLength(10);
+ expect(expanded.items.at(-1)).toMatchObject({
+ type: "show-more",
+ hiddenCount: 0,
+ canShowLess: true,
+ });
+ });
+
it("hides threads and the show-more row for collapsed groups", () => {
const layout = buildHomeListLayout({
groups: [makeGroup("alpha", 12), makeGroup("beta", 2)],
diff --git a/apps/mobile/src/features/home/homeListItems.ts b/apps/mobile/src/features/home/homeListItems.ts
index ce1f492838..eb3f2a5de1 100644
--- a/apps/mobile/src/features/home/homeListItems.ts
+++ b/apps/mobile/src/features/home/homeListItems.ts
@@ -195,7 +195,10 @@ export function buildHomeListLayout(input: {
key: `show-more:${group.key}`,
groupKey: group.key,
hiddenCount,
- canShowLess: visibleCount > HOME_INITIAL_VISIBLE_THREADS,
+ // Compare against the group's own baseline, not the global page size:
+ // stale projects start below HOME_INITIAL_VISIBLE_THREADS, and "Show
+ // less" must be offered as soon as anything beyond the baseline shows.
+ canShowLess: visibleCount > baselineCount,
});
}
}
diff --git a/apps/mobile/src/features/threads/new-task-flow-provider.tsx b/apps/mobile/src/features/threads/new-task-flow-provider.tsx
index 8760f54de5..7c3759d2dd 100644
--- a/apps/mobile/src/features/threads/new-task-flow-provider.tsx
+++ b/apps/mobile/src/features/threads/new-task-flow-provider.tsx
@@ -482,19 +482,33 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
const selectEnvironment = useCallback(
(environmentId: EnvironmentId) => {
+ const projectsOnTarget = projects.filter(
+ (project) => project.environmentId === environmentId,
+ );
const repositoryKey = selectedProject?.repositoryIdentity?.canonicalKey ?? null;
+ // Prefer the repository identity; projects without one (e.g. not yet
+ // indexed) fall back to workspace basename, then title, so switching
+ // computers still follows the same repo instead of resetting to
+ // whatever project is first on the target machine.
+ const workspaceBasename = selectedProject?.workspaceRoot.split("/").at(-1) ?? null;
const match =
- repositoryKey === null
- ? undefined
- : projects.find(
- (project) =>
- project.environmentId === environmentId &&
- (project.repositoryIdentity?.canonicalKey ?? null) === repositoryKey,
- );
+ (repositoryKey !== null
+ ? projectsOnTarget.find(
+ (project) => (project.repositoryIdentity?.canonicalKey ?? null) === repositoryKey,
+ )
+ : undefined) ??
+ (workspaceBasename !== null
+ ? projectsOnTarget.find(
+ (project) => project.workspaceRoot.split("/").at(-1) === workspaceBasename,
+ )
+ : undefined) ??
+ (selectedProject !== null
+ ? projectsOnTarget.find((project) => project.title === selectedProject.title)
+ : undefined);
setSelectedEnvironmentId(environmentId);
setSelectedProjectKey(match ? scopedProjectKey(match.environmentId, match.id) : null);
},
- [projects, selectedProject?.repositoryIdentity?.canonicalKey],
+ [projects, selectedProject],
);
const setWorkspaceMode = useCallback(
diff --git a/apps/mobile/src/features/threads/thread-list-items.tsx b/apps/mobile/src/features/threads/thread-list-items.tsx
index 938eb8a429..dbb341111a 100644
--- a/apps/mobile/src/features/threads/thread-list-items.tsx
+++ b/apps/mobile/src/features/threads/thread-list-items.tsx
@@ -55,22 +55,27 @@ export const ThreadListGroupHeader = memo(function ThreadListGroupHeader(props:
);
const handleNewThread = useCallback(() => onNewThread?.(project), [onNewThread, project]);
+ // The new-thread button is a SIBLING of the collapse toggle, not a child:
+ // nested touchables are unreachable to VoiceOver/TalkBack (the parent
+ // swallows focus), so the row is a plain View with two adjacent pressables.
return (
-
-
{props.threadCount}
- {onNewThread ? (
- ({ opacity: pressed ? 0.5 : 1, marginRight: compact ? 10 : 8 })}
- >
-
-
- ) : null}
+
+ {onNewThread ? (
+ ({ opacity: pressed ? 0.5 : 1, marginRight: compact ? 10 : 8 })}
+ >
+
+
+ ) : null}
+
-
-
+
+
);
});