@devries-cameron20 / t3code-1 / commits / 7cf5b284e6
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(mobile): skip unused legacy list work (#9679)

Theo Browne committed Sep 4, 2026 at 07:03 UTC 7cf5b284e6e37895f535433c77f728b3e4292c9b
3 files changed +101 -77
apps/mobile/src/features/home/HomeScreen.tsx
+51 -41
@@ -61,6 +61,7 @@ import type { HomeListFilterMenuEnvironment } from "./home-list-filter-menu";
61 import {
62 buildHomeListLayout,
63 DEFAULT_GROUP_DISPLAY_STATE,
64 + EMPTY_HOME_LIST_LAYOUT,
65 homeListItemsAreEqual,
66 nextGroupDisplayState,
67 type HomeGroupDisplayAction,
@@ -339,48 +340,57 @@ export function HomeScreen(props: HomeScreenProps) {
340 );
341 const scopedProjects = useMemo(
342 () =>
342 - selectedProjectRefKeys === null
343 - ? props.projects
344 - : props.projects.filter((project) =>
345 - selectedProjectRefKeys.has(scopedProjectKey(project.environmentId, project.id)),
346 - ),
347 - [props.projects, selectedProjectRefKeys],
343 + threadListV2Enabled
344 + ? []
345 + : selectedProjectRefKeys === null
346 + ? props.projects
347 + : props.projects.filter((project) =>
348 + selectedProjectRefKeys.has(scopedProjectKey(project.environmentId, project.id)),
349 + ),
350 + [threadListV2Enabled, props.projects, selectedProjectRefKeys],
351 );
352 const scopedThreads = useMemo(
353 () =>
351 - selectedProjectRefKeys === null
352 - ? props.threads
353 - : props.threads.filter((thread) =>
354 - selectedProjectRefKeys.has(scopedProjectKey(thread.environmentId, thread.projectId)),
355 - ),
356 - [props.threads, selectedProjectRefKeys],
354 + threadListV2Enabled
355 + ? []
356 + : selectedProjectRefKeys === null
357 + ? props.threads
358 + : props.threads.filter((thread) =>
359 + selectedProjectRefKeys.has(scopedProjectKey(thread.environmentId, thread.projectId)),
360 + ),
361 + [threadListV2Enabled, props.threads, selectedProjectRefKeys],
362 );
363 const scopedPendingTasks = useMemo(
364 () =>
360 - selectedProjectRefKeys === null
361 - ? props.pendingTasks
362 - : props.pendingTasks.filter((pendingTask) =>
363 - selectedProjectRefKeys.has(
364 - scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
365 + threadListV2Enabled
366 + ? []
367 + : selectedProjectRefKeys === null
368 + ? props.pendingTasks
369 + : props.pendingTasks.filter((pendingTask) =>
370 + selectedProjectRefKeys.has(
371 + scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
372 + ),
373 ),
366 - ),
367 - [props.pendingTasks, selectedProjectRefKeys],
374 + [threadListV2Enabled, props.pendingTasks, selectedProjectRefKeys],
375 );
376
377 const projectGroups = useMemo(
378 () =>
372 - buildHomeThreadGroups({
373 - projects: scopedProjects,
374 - threads: scopedThreads,
375 - pendingTasks: scopedPendingTasks,
376 - environmentId: props.selectedEnvironmentId,
377 - searchQuery: props.searchQuery,
378 - matchedThreadKeys,
379 - projectSortOrder: props.projectSortOrder,
380 - threadSortOrder: props.threadSortOrder,
381 - projectGroupingMode: props.projectGroupingMode,
382 - }),
379 + threadListV2Enabled
380 + ? []
381 + : buildHomeThreadGroups({
382 + projects: scopedProjects,
383 + threads: scopedThreads,
384 + pendingTasks: scopedPendingTasks,
385 + environmentId: props.selectedEnvironmentId,
386 + searchQuery: props.searchQuery,
387 + matchedThreadKeys,
388 + projectSortOrder: props.projectSortOrder,
389 + threadSortOrder: props.threadSortOrder,
390 + projectGroupingMode: props.projectGroupingMode,
391 + }),
392 [
393 + threadListV2Enabled,
394 props.projectGroupingMode,
395 props.projectSortOrder,
396 props.searchQuery,
@@ -396,12 +406,14 @@ export function HomeScreen(props: HomeScreenProps) {
406 const hasSearchQuery = props.searchQuery.trim().length > 0;
407 const listLayout = useMemo(
408 () =>
399 - buildHomeListLayout({
400 - groups: projectGroups,
401 - displayStates: effectiveGroupDisplayStates,
402 - showAllThreads: hasSearchQuery,
403 - }),
404 - [projectGroups, effectiveGroupDisplayStates, hasSearchQuery],
409 + threadListV2Enabled
410 + ? EMPTY_HOME_LIST_LAYOUT
411 + : buildHomeListLayout({
412 + groups: projectGroups,
413 + displayStates: effectiveGroupDisplayStates,
414 + showAllThreads: hasSearchQuery,
415 + }),
416 + [threadListV2Enabled, projectGroups, effectiveGroupDisplayStates, hasSearchQuery],
417 );
418
419 const projectCwdByKey = useMemo(() => {
@@ -1033,7 +1045,7 @@ export function HomeScreen(props: HomeScreenProps) {
1045 // so the v1 check already covers v2.
1046 const hasAnyThreads =
1047 props.threads.some((thread) => thread.archivedAt === null) || props.pendingTasks.length > 0;
1036 - const hasResults = projectGroups.length > 0;
1048 + const hasResults = threadListV2Enabled ? threadListV2Items.length > 0 : projectGroups.length > 0;
1049 const selectedEnvironmentLabel =
1050 props.selectedEnvironmentId === null
1051 ? null
@@ -1097,10 +1109,8 @@ export function HomeScreen(props: HomeScreenProps) {
1109 <EmptyState title="No threads yet" detail="Create a task to start a new coding session." />
1110 )
1111 ) : null;
1100 - // Self-contained: v1's listEmpty keys off projectGroups, which ignores the
1101 - // v2 project scope, so it can be null (results elsewhere) while this list
1102 - // is empty. Snoozed threads need no special empty state: their shelf header
1103 - // is a list row even while collapsed.
1112 + // Use the v2 project scope for its empty state. Snoozed threads need no
1113 + // special empty state: their shelf header is a list row even while collapsed.
1114 const v2ListEmpty =
1115 hasSearchQuery && threadSearch.isPending ? null : hasSearchQuery ? (
1116 <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
apps/mobile/src/features/home/homeListItems.ts
+2
@@ -62,6 +62,8 @@ export interface HomeListLayout {
62 readonly stickyHeaderIndices: ReadonlyArray<number>;
63 }
64
65 +export const EMPTY_HOME_LIST_LAYOUT: HomeListLayout = { items: [], stickyHeaderIndices: [] };
66 +
67 export type HomeGroupDisplayAction = "toggle-collapsed" | "show-more" | "show-less";
68
69 export function nextGroupDisplayState(
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+48 -36
@@ -45,6 +45,7 @@ import { buildHomeListFilterMenu } from "../home/home-list-filter-menu";
45 import {
46 buildHomeListLayout,
47 DEFAULT_GROUP_DISPLAY_STATE,
48 + EMPTY_HOME_LIST_LAYOUT,
49 homeListItemsAreEqual,
50 nextGroupDisplayState,
51 type HomeGroupDisplayAction,
@@ -269,47 +270,56 @@ function ThreadNavigationSidebarPane(
270 );
271 const scopedProjects = useMemo(
272 () =>
272 - selectedProjectRefs === null
273 - ? projects
274 - : projects.filter((project) =>
275 - selectedProjectRefs.has(scopedProjectKey(project.environmentId, project.id)),
276 - ),
277 - [projects, selectedProjectRefs],
273 + threadListV2Enabled
274 + ? []
275 + : selectedProjectRefs === null
276 + ? projects
277 + : projects.filter((project) =>
278 + selectedProjectRefs.has(scopedProjectKey(project.environmentId, project.id)),
279 + ),
280 + [threadListV2Enabled, projects, selectedProjectRefs],
281 );
282 const scopedThreads = useMemo(
283 () =>
281 - selectedProjectRefs === null
282 - ? threads
283 - : threads.filter((thread) =>
284 - selectedProjectRefs.has(scopedProjectKey(thread.environmentId, thread.projectId)),
285 - ),
286 - [selectedProjectRefs, threads],
284 + threadListV2Enabled
285 + ? []
286 + : selectedProjectRefs === null
287 + ? threads
288 + : threads.filter((thread) =>
289 + selectedProjectRefs.has(scopedProjectKey(thread.environmentId, thread.projectId)),
290 + ),
291 + [threadListV2Enabled, selectedProjectRefs, threads],
292 );
293 const scopedPendingTasks = useMemo(
294 () =>
290 - selectedProjectRefs === null
291 - ? pendingTasks
292 - : pendingTasks.filter((pendingTask) =>
293 - selectedProjectRefs.has(
294 - scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
295 + threadListV2Enabled
296 + ? []
297 + : selectedProjectRefs === null
298 + ? pendingTasks
299 + : pendingTasks.filter((pendingTask) =>
300 + selectedProjectRefs.has(
301 + scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
302 + ),
303 ),
296 - ),
297 - [pendingTasks, selectedProjectRefs],
304 + [threadListV2Enabled, pendingTasks, selectedProjectRefs],
305 );
306 const groups = useMemo(
307 () =>
301 - buildHomeThreadGroups({
302 - projects: scopedProjects,
303 - threads: scopedThreads,
304 - pendingTasks: scopedPendingTasks,
305 - environmentId: options.selectedEnvironmentId,
306 - searchQuery: props.searchQuery,
307 - matchedThreadKeys,
308 - projectSortOrder: options.projectSortOrder,
309 - threadSortOrder: options.threadSortOrder,
310 - projectGroupingMode: options.projectGroupingMode,
311 - }),
308 + threadListV2Enabled
309 + ? []
310 + : buildHomeThreadGroups({
311 + projects: scopedProjects,
312 + threads: scopedThreads,
313 + pendingTasks: scopedPendingTasks,
314 + environmentId: options.selectedEnvironmentId,
315 + searchQuery: props.searchQuery,
316 + matchedThreadKeys,
317 + projectSortOrder: options.projectSortOrder,
318 + threadSortOrder: options.threadSortOrder,
319 + projectGroupingMode: options.projectGroupingMode,
320 + }),
321 [
322 + threadListV2Enabled,
323 matchedThreadKeys,
324 options,
325 props.searchQuery,
@@ -334,12 +344,14 @@ function ThreadNavigationSidebarPane(
344 const hasSearchQuery = props.searchQuery.trim().length > 0;
345 const listLayout = useMemo(
346 () =>
337 - buildHomeListLayout({
338 - groups,
339 - displayStates: groupDisplayStates,
340 - showAllThreads: hasSearchQuery,
341 - }),
342 - [groups, groupDisplayStates, hasSearchQuery],
347 + threadListV2Enabled
348 + ? EMPTY_HOME_LIST_LAYOUT
349 + : buildHomeListLayout({
350 + groups,
351 + displayStates: groupDisplayStates,
352 + showAllThreads: hasSearchQuery,
353 + }),
354 + [threadListV2Enabled, groups, groupDisplayStates, hasSearchQuery],
355 );
356 const projectCwdByKey = useMemo(() => {
357 const map = new Map<string, string>();