From c14b30b9324ebca99b40155082c0547a653b2146 Mon Sep 17 00:00:00 2001 From: Rishi Balakrishnan Date: Mon, 3 Aug 2026 21:10:35 -0400 Subject: [PATCH] refactor: drop the always-use-home-appview preference entirely --- src/state/appview-fallback-controller.tsx | 6 +-- src/state/persisted/schema.ts | 2 - .../preferences/always-use-home-appview.tsx | 50 ------------------- src/state/preferences/index.tsx | 9 +--- 4 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 src/state/preferences/always-use-home-appview.tsx diff --git a/src/state/appview-fallback-controller.tsx b/src/state/appview-fallback-controller.tsx index 02526f750..c226d85e5 100644 --- a/src/state/appview-fallback-controller.tsx +++ b/src/state/appview-fallback-controller.tsx @@ -11,7 +11,6 @@ import { getThresholds, INITIAL_DECIDER_STATE, } from '#/state/appview-status' -import {useAlwaysUseHomeAppview} from '#/state/preferences' import {useAgent, useSession} from '#/state/session' import {Features, features} from '#/analytics/features' @@ -27,11 +26,10 @@ export function AppviewFallbackController() { const agent = useAgent() const queryClient = useQueryClient() const {hasSession} = useSession() - const alwaysUseHomeAppview = useAlwaysUseHomeAppview() const deciderRef = useRef(INITIAL_DECIDER_STATE) const evaluate = useCallback(async () => { - if (!hasSession || alwaysUseHomeAppview) { + if (!hasSession) { setFallbackActive(false, agent, queryClient) return } @@ -58,7 +56,7 @@ export function AppviewFallbackController() { const eligibility = await probeFallbackEligibility(agent) setFallbackActive(eligibility === 'eligible', agent, queryClient, mode) - }, [agent, queryClient, hasSession, alwaysUseHomeAppview]) + }, [agent, queryClient, hasSession]) useEffect(() => { void evaluate() diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts index bb2781844..19b7feab6 100644 --- a/src/state/persisted/schema.ts +++ b/src/state/persisted/schema.ts @@ -145,7 +145,6 @@ const schema = z.object({ hideFollowNotifications: z.boolean().optional(), showLinkInHandle: z.boolean().optional(), blackskyOnlyDefault: z.boolean().optional(), - alwaysUseHomeAppview: z.boolean().optional(), /** @deprecated */ mutedThreads: z.array(z.string()), @@ -206,7 +205,6 @@ export const defaults: Schema = { repostCarouselEnabled: false, hideFollowNotifications: false, showLinkInHandle: false, - alwaysUseHomeAppview: false, } export function tryParse(rawData: string): Schema | undefined { diff --git a/src/state/preferences/always-use-home-appview.tsx b/src/state/preferences/always-use-home-appview.tsx deleted file mode 100644 index 32f2b1554..000000000 --- a/src/state/preferences/always-use-home-appview.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { - createContext, - useCallback, - useContext, - useEffect, - useState, -} from 'react' - -import * as persisted from '#/state/persisted' - -type StateContext = boolean -type SetContext = (v: boolean) => void - -const stateContext = createContext( - Boolean(persisted.defaults.alwaysUseHomeAppview), -) -stateContext.displayName = 'AlwaysUseHomeAppviewStateContext' -const setContext = createContext((_: boolean) => {}) -setContext.displayName = 'AlwaysUseHomeAppviewSetContext' - -export function Provider({children}: {children: React.ReactNode}) { - const [state, setState] = useState( - Boolean(persisted.get('alwaysUseHomeAppview')), - ) - - const setStateWrapped = useCallback( - (value: persisted.Schema['alwaysUseHomeAppview']) => { - setState(Boolean(value)) - void persisted.write('alwaysUseHomeAppview', value) - }, - [setState], - ) - - useEffect(() => { - return persisted.onUpdate('alwaysUseHomeAppview', next => { - setState(Boolean(next)) - }) - }, [setStateWrapped]) - - return ( - - - {children} - - - ) -} - -export const useAlwaysUseHomeAppview = () => useContext(stateContext) -export const useSetAlwaysUseHomeAppview = () => useContext(setContext) diff --git a/src/state/preferences/index.tsx b/src/state/preferences/index.tsx index 48c8a8cd3..37e08f149 100644 --- a/src/state/preferences/index.tsx +++ b/src/state/preferences/index.tsx @@ -1,5 +1,4 @@ import {Provider as AltTextRequiredProvider} from './alt-text-required' -import {Provider as AlwaysUseHomeAppviewProvider} from './always-use-home-appview' import {Provider as AutoplayProvider} from './autoplay' import {Provider as BlackskyOnlyDefaultProvider} from './blacksky-only-default' import {Provider as DisableHapticsProvider} from './disable-haptics' @@ -17,10 +16,6 @@ export { useRequireAltTextEnabled, useSetRequireAltTextEnabled, } from './alt-text-required' -export { - useAlwaysUseHomeAppview, - useSetAlwaysUseHomeAppview, -} from './always-use-home-appview' export {useAutoplayDisabled, useSetAutoplayDisabled} from './autoplay' export { useBlackskyOnlyDefault, @@ -50,9 +45,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { - - {children} - + {children} -- knotmirror 0.0.1