Open History to see the last commit
1import { useAtomValue } from "@effect/atom-react";
2import { AsyncResult } from "effect/unstable/reactivity";
3
4import { mobilePreferencesAtom } from "../../state/preferences";
5import { resolveThreadListV2Enabled } from "./threadListV2";
6
7/**
8 * Resolved Thread List v2 state: on unless the device opted into the legacy
9 * grouped list (Settings → Legacy). Every consumer must read through this
10 * rather than the raw preference, which is undefined until explicitly chosen.
11 */
12export function useThreadListV2Enabled(): boolean {
13 const preferencesResult = useAtomValue(mobilePreferencesAtom);
14 const loaded = AsyncResult.isSuccess(preferencesResult);
15 return resolveThreadListV2Enabled({
16 legacyPreference: loaded ? preferencesResult.value.legacyThreadListEnabled : undefined,
17 preferencesLoaded: loaded,
18 });
19}