11import type { EnvironmentId , SidebarThreadSortOrder } from "@t3tools/contracts" ;
22import type { MenuAction } from "@react-native-menu/menu" ;
3- import { useAtomValue } from "@effect/atom-react" ;
4- import { AsyncResult } from "effect/unstable/reactivity" ;
53import { NativeHeaderToolbar , NativeStackScreenOptions } from "../../native/StackHeader" ;
64import { useCallback , useMemo , useRef } from "react" ;
75import { Platform , Pressable , Text as RNText , TextInput , View } from "react-native" ;
@@ -12,7 +10,7 @@ import { ControlPillMenu } from "../../components/ControlPill";
1210import { SymbolView } from "../../components/AppSymbol" ;
1311import { T3Wordmark } from "../../components/T3Wordmark" ;
1412import { useThemeColor } from "../../lib/useThemeColor" ;
15- import { mobilePreferencesAtom } from "../../state/preferences " ;
13+ import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled " ;
1614import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands" ;
1715import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items" ;
1816import { createNativeMailSearchToolbarItem } from "../layout/native-mail-search-toolbar" ;
@@ -59,21 +57,14 @@ function checkedMenuState(checked: boolean) {
5957 return checked ? ( "on" as const ) : undefined ;
6058}
6159
62- /** Thread List v2 lays the list out in fixed creation order, so the
63- sort/group filter controls would be silently ignored — hide them and
64- key the "customized" icon state off the environment filter alone. */
65- function useThreadListV2FilterGate ( ) {
66- const preferencesResult = useAtomValue ( mobilePreferencesAtom ) ;
67- return (
68- AsyncResult . isSuccess ( preferencesResult ) && preferencesResult . value . threadListV2Enabled === true
69- ) ;
70- }
71-
7260function AndroidHomeHeader ( props : HomeHeaderProps ) {
7361 const insets = useSafeAreaInsets ( ) ;
7462 const iconColor = useThemeColor ( "--color-icon" ) ;
7563 const mutedColor = useThemeColor ( "--color-foreground-muted" ) ;
76- const threadListV2Enabled = useThreadListV2FilterGate ( ) ;
64+ // Thread List v2 lays the list out in fixed creation order, so the
65+ // sort/group filter controls would be silently ignored — hide them and
66+ // key the "customized" icon state off the environment filter alone.
67+ const threadListV2Enabled = useThreadListV2Enabled ( ) ;
7768 const hasCustomListOptions = threadListV2Enabled
7869 ? props . selectedEnvironmentId !== null || props . selectedProjectKey !== null
7970 : hasCustomHomeListOptions ( props ) ;
@@ -291,7 +282,10 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
291282function IosHomeHeader ( props : HomeHeaderProps ) {
292283 const searchBarRef = useRef < SearchBarCommands > ( null ) ;
293284 const iconColor = useThemeColor ( "--color-icon" ) ;
294- const threadListV2Enabled = useThreadListV2FilterGate ( ) ;
285+ // Thread List v2 lays the list out in fixed creation order, so the
286+ // sort/group filter controls would be silently ignored — hide them and
287+ // key the "customized" icon state off the environment filter alone.
288+ const threadListV2Enabled = useThreadListV2Enabled ( ) ;
295289 const hasCustomListOptions = threadListV2Enabled
296290 ? props . selectedEnvironmentId !== null || props . selectedProjectKey !== null
297291 : hasCustomHomeListOptions ( props ) ;
0 commit comments