From a896942bc7177337a28b53e3bf25cc6ce9ca2b98 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 23 Jun 2026 22:47:55 -0700 Subject: [PATCH] Improve mobile thread navigation and diff selection - Keep sidebar threads swipeable with archive/delete actions - Hide archived threads from navigation groups - Stabilize review diff visibility and optimistic file selection Co-authored-by: codex --- .../t3-review-diff/ios/T3ReviewDiffView.swift | 21 +- .../diffs/nativeReviewDiffSurface.test.ts | 17 ++ .../features/diffs/nativeReviewDiffSurface.ts | 7 +- .../src/features/files/FileTreeBrowser.tsx | 18 ++ apps/mobile/src/features/home/HomeScreen.tsx | 223 +++++++----------- .../features/home/thread-swipe-actions.tsx | 105 ++++++++- .../src/features/review/ReviewSheet.tsx | 12 +- .../src/features/threads/ThreadFeed.tsx | 6 +- .../threads/ThreadNavigationSidebar.tsx | 95 ++++++-- .../threads/thread-navigation-groups.test.ts | 17 ++ .../threads/thread-navigation-groups.ts | 3 +- 11 files changed, 336 insertions(+), 188 deletions(-) diff --git a/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift b/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift index 07e57b9db3..9a7a5004da 100644 --- a/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift +++ b/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift @@ -550,6 +550,8 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate { } self.contentResetKey = contentResetKey + tokensDecodeGeneration += 1 + contentView.tokensByRowId = [:] hasAppliedInitialRowIndex = false lastVisibleFileId = nil pendingScrollFileId = nil @@ -684,8 +686,23 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate { // Keep the explicit destination selected while UIKit animates through the files // between the old and new offsets. Emitting every intermediate header forces a // React render per crossing and makes the navigator visibly flash. - guard !isProgrammaticScrollActive, - let fileId = contentView.visibleFileId(atVerticalOffset: scrollView.contentOffset.y), + guard !isProgrammaticScrollActive else { + return + } + + // The top of the combined diff is the explicit "All files" destination. + // Treat it as a first-class selection instead of immediately resolving the + // first file header and undoing the navigator's optimistic selection. + if scrollView.contentOffset.y <= 0.5 { + guard lastVisibleFileId != nil else { + return + } + lastVisibleFileId = nil + onVisibleFileChange(["fileId": NSNull()]) + return + } + + guard let fileId = contentView.visibleFileId(atVerticalOffset: scrollView.contentOffset.y), fileId != lastVisibleFileId else { return } diff --git a/apps/mobile/src/features/diffs/nativeReviewDiffSurface.test.ts b/apps/mobile/src/features/diffs/nativeReviewDiffSurface.test.ts index 1ea15344c3..0409655583 100644 --- a/apps/mobile/src/features/diffs/nativeReviewDiffSurface.test.ts +++ b/apps/mobile/src/features/diffs/nativeReviewDiffSurface.test.ts @@ -81,3 +81,20 @@ describe("resolveNativeReviewDiffView", () => { expect(consoleError).toHaveBeenCalledTimes(1); }); }); + +describe("isPendingNativeViewRegistration", () => { + it("recognizes registration races for the installed native view name", async () => { + const { isPendingNativeViewRegistration } = await import("./nativeReviewDiffSurface"); + + expect( + isPendingNativeViewRegistration( + new Error("Unable to find the 'T3ReviewDiffSurface' view for this native tag"), + ), + ).toBe(true); + expect( + isPendingNativeViewRegistration( + new Error("Unable to find the 'T3ReviewDiffView' view for this native tag"), + ), + ).toBe(false); + }); +}); diff --git a/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts b/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts index 87fd51565d..a4896dc401 100644 --- a/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts +++ b/apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts @@ -124,7 +124,7 @@ export interface NativeReviewDiffViewProps extends ViewProps { readonly nativeViewRef?: Ref; readonly onDebug?: (event: NativeSyntheticEvent>) => void; readonly onVisibleFileChange?: ( - event: NativeSyntheticEvent<{ readonly fileId?: string }>, + event: NativeSyntheticEvent<{ readonly fileId?: string | null }>, ) => void; readonly onToggleFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void; readonly onToggleViewedFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void; @@ -166,9 +166,10 @@ let nativeReviewDiffViewResolutionFailed = false; type NativeReviewDiffPayloadMethod = "setRowsJson" | "setTokensJson" | "setTokensPatchJson"; -function isPendingNativeViewRegistration(error: unknown): boolean { +export function isPendingNativeViewRegistration(error: unknown): boolean { return ( - error instanceof Error && error.message.includes("Unable to find the 'T3ReviewDiffView' view") + error instanceof Error && + error.message.includes(`Unable to find the '${NATIVE_REVIEW_DIFF_MODULE_NAME}' view`) ); } diff --git a/apps/mobile/src/features/files/FileTreeBrowser.tsx b/apps/mobile/src/features/files/FileTreeBrowser.tsx index 0f89092ddd..77a477c564 100644 --- a/apps/mobile/src/features/files/FileTreeBrowser.tsx +++ b/apps/mobile/src/features/files/FileTreeBrowser.tsx @@ -18,6 +18,7 @@ import { const fileTreeCache = new WeakMap, ReadonlyArray>(); const FILE_TREE_INITIAL_RENDER_COUNT = 20; const FILE_TREE_RENDER_BATCH_SIZE = 12; +const OPTIMISTIC_SELECTION_TIMEOUT_MS = 1_000; function cachedFileTree(entries: ReadonlyArray): ReadonlyArray { const cached = fileTreeCache.get(entries); @@ -120,6 +121,7 @@ export function FileTreeBrowser(props: { const iconColor = String(useThemeColor("--color-icon-muted")); const { onPreviewFile, onSelectFile, selectedPath: controlledSelectedPath } = props; const controlledSelectedPathRef = useRef(controlledSelectedPath); + const pendingSelectionTimeoutRef = useRef | null>(null); controlledSelectedPathRef.current = controlledSelectedPath; const selectedPath = @@ -164,6 +166,15 @@ export function FileTreeBrowser(props: { }); }, [controlledSelectedPath]); + useEffect( + () => () => { + if (pendingSelectionTimeoutRef.current !== null) { + clearTimeout(pendingSelectionTimeoutRef.current); + } + }, + [], + ); + const toggleDirectory = useCallback((path: string) => { setExpandedPaths((current) => { const next = new Set(current); @@ -177,10 +188,17 @@ export function FileTreeBrowser(props: { }, []); const handleSelectFile = useCallback( (path: string) => { + if (pendingSelectionTimeoutRef.current !== null) { + clearTimeout(pendingSelectionTimeoutRef.current); + } setPendingSelection({ path, selectedPathAtPress: controlledSelectedPathRef.current, }); + pendingSelectionTimeoutRef.current = setTimeout(() => { + pendingSelectionTimeoutRef.current = null; + setPendingSelection((current) => (current?.path === path ? null : current)); + }, OPTIMISTIC_SELECTION_TIMEOUT_MS); onSelectFile(path); }, [onSelectFile], diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx index 7ee5660edf..ed10660b8f 100644 --- a/apps/mobile/src/features/home/HomeScreen.tsx +++ b/apps/mobile/src/features/home/HomeScreen.tsx @@ -7,13 +7,10 @@ import type { SidebarProjectGroupingMode, SidebarThreadSortOrder, } from "@t3tools/contracts"; -import * as Haptics from "expo-haptics"; import { SymbolView } from "expo-symbols"; import { useCallback, useMemo, useRef, useState } from "react"; import { ActivityIndicator, Pressable, ScrollView, useWindowDimensions, View } from "react-native"; -import ReanimatedSwipeable, { - type SwipeableMethods, -} from "react-native-gesture-handler/ReanimatedSwipeable"; +import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable"; import Animated, { Easing, LinearTransition, @@ -32,11 +29,7 @@ import type { SavedRemoteConnection } from "../../lib/connection"; import { relativeTime } from "../../lib/time"; import { threadStatusTone } from "../threads/threadPresentation"; import { buildHomeThreadGroups, type HomeProjectSortOrder } from "./homeThreadList"; -import { - THREAD_SWIPE_ACTIONS_WIDTH, - THREAD_SWIPE_SPRING, - ThreadSwipeActions, -} from "./thread-swipe-actions"; +import { ThreadSwipeable } from "./thread-swipe-actions"; /* ─── Types ──────────────────────────────────────────────────────────── */ @@ -219,13 +212,10 @@ function ThreadRow(props: { readonly onSwipeableClose: (methods: SwipeableMethods) => void; readonly isLast: boolean; }) { - const swipeableRef = useRef(null); - const fullSwipeArmedRef = useRef(false); const { width: windowWidth } = useWindowDimensions(); const separatorColor = useThemeColor("--color-separator"); const iconSubtleColor = useThemeColor("--color-icon-subtle"); const cardColor = useThemeColor("--color-card"); - const fullSwipeThreshold = Math.max(THREAD_SWIPE_ACTIONS_WIDTH + 44, (windowWidth - 32) * 0.58); const { bg, fg } = statusColors(props.thread); const tone = threadStatusTone(props.thread); const timestamp = relativeTime( @@ -235,150 +225,107 @@ function ThreadRow(props: { const subtitleParts = [props.environmentLabel, branch].filter((part): part is string => Boolean(part), ); - const handleFullSwipeArmedChange = useCallback((armed: boolean) => { - if (armed && !fullSwipeArmedRef.current && process.env.EXPO_OS === "ios") { - void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium); - } - fullSwipeArmedRef.current = armed; - }, []); return ( - { - fullSwipeArmedRef.current = false; - if (swipeableRef.current) { - props.onSwipeableClose(swipeableRef.current); - } + { - if (swipeableRef.current) { - props.onSwipeableWillOpen(swipeableRef.current); - } - }} - onSwipeableWillOpen={() => { - const methods = swipeableRef.current; - if (!methods) { - return; - } - - props.onSwipeableWillOpen(methods); - if (fullSwipeArmedRef.current) { - fullSwipeArmedRef.current = false; - methods.close(); - props.onDelete(); - } - }} - overshootFriction={1} - overshootRight - renderRightActions={(_progress, translation, methods) => ( - - )} - rightThreshold={THREAD_SWIPE_ACTIONS_WIDTH * 0.42} + threadTitle={props.thread.title} > - { - swipeableRef.current?.close(); - props.onPress(); - }} - style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })} - > - ( + { + close(); + props.onPress(); }} + style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })} > - - - - - - - {props.thread.title} - - - - - {tone.label} - - - - {timestamp} - - + + - {subtitleParts.length > 0 ? ( - - + + - {subtitleParts.join(" · ")} + {props.thread.title} + + + + {tone.label} + + + + {timestamp} + + - ) : null} + + {subtitleParts.length > 0 ? ( + + + + {subtitleParts.join(" · ")} + + + ) : null} + - - - + + )} + ); } diff --git a/apps/mobile/src/features/home/thread-swipe-actions.tsx b/apps/mobile/src/features/home/thread-swipe-actions.tsx index dd0e2901bb..e8b88885bb 100644 --- a/apps/mobile/src/features/home/thread-swipe-actions.tsx +++ b/apps/mobile/src/features/home/thread-swipe-actions.tsx @@ -1,8 +1,11 @@ import { SymbolView } from "expo-symbols"; -import type { ComponentProps } from "react"; -import type { ColorValue } from "react-native"; +import * as Haptics from "expo-haptics"; +import { useCallback, useRef, type ComponentProps, type ReactNode } from "react"; +import type { ColorValue, StyleProp, ViewStyle } from "react-native"; import { Pressable, View } from "react-native"; -import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable"; +import ReanimatedSwipeable, { + type SwipeableMethods, +} from "react-native-gesture-handler/ReanimatedSwipeable"; import Animated, { Extrapolation, interpolate, @@ -26,6 +29,95 @@ export const THREAD_SWIPE_SPRING = { stiffness: 330, }; +interface ThreadSwipePrimaryAction { + readonly accessibilityLabel: string; + readonly icon: ComponentProps["name"]; + readonly label: string; + readonly onPress: () => void; +} + +export function ThreadSwipeable(props: { + readonly backgroundColor: ColorValue; + readonly children: (close: () => void) => ReactNode; + readonly containerStyle?: StyleProp; + readonly fullSwipeWidth: number; + readonly onDelete: () => void; + readonly onSwipeableClose?: (methods: SwipeableMethods) => void; + readonly onSwipeableWillOpen?: (methods: SwipeableMethods) => void; + readonly primaryAction: ThreadSwipePrimaryAction; + readonly threadTitle: string; +}) { + const swipeableRef = useRef(null); + const fullSwipeArmedRef = useRef(false); + const fullSwipeThreshold = Math.max(THREAD_SWIPE_ACTIONS_WIDTH + 44, props.fullSwipeWidth * 0.58); + const close = useCallback(() => swipeableRef.current?.close(), []); + const handleFullSwipeArmedChange = useCallback((armed: boolean) => { + if (armed && !fullSwipeArmedRef.current && process.env.EXPO_OS === "ios") { + void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium); + } + fullSwipeArmedRef.current = armed; + }, []); + + return ( + { + fullSwipeArmedRef.current = false; + if (swipeableRef.current) { + props.onSwipeableClose?.(swipeableRef.current); + } + }} + onSwipeableOpenStartDrag={() => { + if (swipeableRef.current) { + props.onSwipeableWillOpen?.(swipeableRef.current); + } + }} + onSwipeableWillOpen={() => { + const methods = swipeableRef.current; + if (!methods) { + return; + } + + props.onSwipeableWillOpen?.(methods); + if (fullSwipeArmedRef.current) { + fullSwipeArmedRef.current = false; + methods.close(); + props.onDelete(); + } + }} + overshootFriction={1} + overshootRight + renderRightActions={(_progress, translation, methods) => ( + { + methods.close(); + props.primaryAction.onPress(); + }, + }} + swipeableMethods={methods} + threadTitle={props.threadTitle} + translation={translation} + /> + )} + rightThreshold={THREAD_SWIPE_ACTIONS_WIDTH * 0.42} + > + {props.children(close)} + + ); +} + function SwipeActionButton(props: { readonly accessibilityLabel: string; readonly backgroundColor: string; @@ -179,12 +271,7 @@ export function ThreadSwipeActions(props: { readonly fullSwipeThreshold: number; readonly onDelete: () => void; readonly onFullSwipeArmedChange: (armed: boolean) => void; - readonly primaryAction: { - readonly accessibilityLabel: string; - readonly icon: ComponentProps["name"]; - readonly label: string; - readonly onPress: () => void; - }; + readonly primaryAction: ThreadSwipePrimaryAction; readonly swipeableMethods: SwipeableMethods; readonly threadTitle: string; readonly translation: SharedValue; diff --git a/apps/mobile/src/features/review/ReviewSheet.tsx b/apps/mobile/src/features/review/ReviewSheet.tsx index e4bef42669..82c7b5b879 100644 --- a/apps/mobile/src/features/review/ReviewSheet.tsx +++ b/apps/mobile/src/features/review/ReviewSheet.tsx @@ -179,7 +179,7 @@ const ReviewFileNavigatorRow = memo(function ReviewFileNavigatorRow(props: { }); interface ReviewFileNavigatorHandle { - readonly setVisibleFile: (fileId: string) => void; + readonly setVisibleFile: (fileId: string | null) => void; } interface ReviewFileNavigatorProps { @@ -212,7 +212,7 @@ function ReviewFileNavigator({ ref, () => ({ setVisibleFile: (fileId) => { - if (!availableFileIds.includes(fileId)) { + if (fileId !== null && !availableFileIds.includes(fileId)) { return; } setFileSelection((current) => { @@ -482,12 +482,8 @@ export function ReviewSheet() { [collapsedFileIds, commentSelection, toggleExpandedFile], ); const handleVisibleFileChange = useCallback( - (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => { - const { fileId } = event.nativeEvent; - if (!fileId) { - return; - } - reviewFileNavigatorRef.current?.setVisibleFile(fileId); + (event: NativeSyntheticEvent<{ readonly fileId?: string | null }>) => { + reviewFileNavigatorRef.current?.setVisibleFile(event.nativeEvent.fileId ?? null); }, [], ); diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx index 181e21c9f4..9d5d480882 100644 --- a/apps/mobile/src/features/threads/ThreadFeed.tsx +++ b/apps/mobile/src/features/threads/ThreadFeed.tsx @@ -1124,7 +1124,9 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { const disclosureAnchorKeyRef = useRef(null); const previousLatestTurnRef = useRef(props.latestTurn); const { width: windowWidth } = useWindowDimensions(); - const [viewportWidth, setViewportWidth] = useState(windowWidth); + const [viewportWidth, setViewportWidth] = useState(() => + props.layoutVariant === "split" ? 0 : windowWidth, + ); const [disclosureToggleSettling, setDisclosureToggleSettling] = useState(false); const [interactionState, setInteractionState] = useState<{ readonly copiedRowId: string | null; @@ -1201,6 +1203,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { markdownStyles, reviewCommentColors, userBubbleColor, + viewportWidth, }), [ copiedRowId, @@ -1209,6 +1212,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { markdownStyles, reviewCommentColors, userBubbleColor, + viewportWidth, ], ); const expandedWorkGroupIds = useMemo(() => { diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index f849912280..959c99b5c7 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -1,7 +1,8 @@ import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; import { SymbolView } from "expo-symbols"; -import { useMemo, useState } from "react"; +import { useCallback, useMemo, useRef, useState } from "react"; import { Pressable, ScrollView, StyleSheet, TextInput, View } from "react-native"; +import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { AppText as Text } from "../../components/AppText"; @@ -10,6 +11,8 @@ import { scopedThreadKey } from "../../lib/scopedEntities"; import { relativeTime } from "../../lib/time"; import { useThemeColor } from "../../lib/useThemeColor"; import { useProjects, useThreadShells } from "../../state/entities"; +import { ThreadSwipeable } from "../home/thread-swipe-actions"; +import { useThreadListActions } from "../home/useThreadListActions"; import { buildThreadNavigationGroups } from "./thread-navigation-groups"; import { SidebarHeaderActions } from "./sidebar-header-actions"; import { threadStatusTone } from "./threadPresentation"; @@ -25,6 +28,8 @@ export function ThreadNavigationSidebar(props: { const projects = useProjects(); const threads = useThreadShells(); const [searchQuery, setSearchQuery] = useState(""); + const openSwipeableRef = useRef(null); + const { archiveThread, confirmDeleteThread } = useThreadListActions(); const groups = useMemo( () => buildThreadNavigationGroups({ projects, threads, searchQuery }), [projects, searchQuery, threads], @@ -38,6 +43,17 @@ export function ThreadNavigationSidebar(props: { const searchBackgroundColor = useThemeColor("--color-subtle-strong"); const selectedBackgroundColor = useThemeColor("--color-subtle-strong"); const pressedBackgroundColor = useThemeColor("--color-subtle"); + const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => { + if (openSwipeableRef.current !== methods) { + openSwipeableRef.current?.close(); + openSwipeableRef.current = methods; + } + }, []); + const handleSwipeableClose = useCallback((methods: SwipeableMethods) => { + if (openSwipeableRef.current === methods) { + openSwipeableRef.current = null; + } + }, []); return ( openSwipeableRef.current?.close()} showsVerticalScrollIndicator={false} style={styles.threadList} > @@ -106,33 +123,55 @@ export function ThreadNavigationSidebar(props: { const selected = threadKey === props.selectedThreadKey; return ( - props.onSelectThread(thread)} - style={({ pressed }) => [ - styles.threadRow, - { - backgroundColor: selected - ? selectedBackgroundColor - : pressed - ? pressedBackgroundColor - : "transparent", - }, - ]} + backgroundColor={backgroundColor} + containerStyle={styles.threadRowContainer} + fullSwipeWidth={props.width - 20} + onDelete={() => confirmDeleteThread(thread)} + onSwipeableClose={handleSwipeableClose} + onSwipeableWillOpen={handleSwipeableWillOpen} + primaryAction={{ + accessibilityLabel: `Archive ${thread.title}`, + icon: "archivebox", + label: "Archive", + onPress: () => archiveThread(thread), + }} + threadTitle={thread.title} > - - - {thread.title} - - - {relativeTime(thread.updatedAt ?? thread.createdAt)} - - - - + {(close) => ( + { + close(); + props.onSelectThread(thread); + }} + style={({ pressed }) => [ + styles.threadRow, + { + backgroundColor: selected + ? selectedBackgroundColor + : pressed + ? pressedBackgroundColor + : backgroundColor, + }, + ]} + > + + + {thread.title} + + + {relativeTime(thread.updatedAt ?? thread.createdAt)} + + + + + )} + ); }) )} @@ -197,6 +236,10 @@ const styles = StyleSheet.create({ alignItems: "center", gap: 8, }, + threadRowContainer: { + borderRadius: 10, + overflow: "hidden", + }, threadText: { minWidth: 0, flex: 1, diff --git a/apps/mobile/src/features/threads/thread-navigation-groups.test.ts b/apps/mobile/src/features/threads/thread-navigation-groups.test.ts index fb2f0ee576..2cfda2f486 100644 --- a/apps/mobile/src/features/threads/thread-navigation-groups.test.ts +++ b/apps/mobile/src/features/threads/thread-navigation-groups.test.ts @@ -91,4 +91,21 @@ describe("buildThreadNavigationGroups", () => { })[0]?.threads.map((thread) => thread.id), ).toEqual(["newer", "older"]); }); + + it("excludes archived threads from the navigation sidebar", () => { + const archived = makeThread({ + id: ThreadId.make("archived"), + projectId: project.id, + title: "Archived work", + archivedAt: "2026-06-04T00:00:00.000Z", + updatedAt: "2026-06-04T00:00:00.000Z", + }); + + expect( + buildThreadNavigationGroups({ + projects: [project], + threads: [...threads, archived], + })[0]?.threads.map((thread) => thread.id), + ).toEqual(["newer", "older"]); + }); }); diff --git a/apps/mobile/src/features/threads/thread-navigation-groups.ts b/apps/mobile/src/features/threads/thread-navigation-groups.ts index ae50031b6d..1531f6deb6 100644 --- a/apps/mobile/src/features/threads/thread-navigation-groups.ts +++ b/apps/mobile/src/features/threads/thread-navigation-groups.ts @@ -30,8 +30,9 @@ export function buildThreadNavigationGroups(input: { readonly searchQuery?: string; }): ReadonlyArray { const query = input.searchQuery?.trim().toLocaleLowerCase() ?? ""; + const activeThreads = input.threads.filter((thread) => thread.archivedAt === null); - return groupProjectsByRepository(input).flatMap((group) => { + return groupProjectsByRepository({ ...input, threads: activeThreads }).flatMap((group) => { const threads = Arr.sort( group.projects.flatMap((projectGroup) => projectGroup.threads), threadActivityOrder,