Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Experiment] Ignore the persisted tab (#3442)

authored by

dan and committed by
GitHub
6d3f9397 f03390e4

+14 -7
+14 -7
src/state/shell/selected-feed.tsx
··· 1 1 import React from 'react' 2 - import * as persisted from '#/state/persisted' 2 + 3 + import {useGate} from '#/lib/statsig/statsig' 3 4 import {isWeb} from '#/platform/detection' 5 + import * as persisted from '#/state/persisted' 4 6 5 7 type StateContext = string 6 8 type SetContext = (v: string) => void ··· 8 10 const stateContext = React.createContext<StateContext>('home') 9 11 const setContext = React.createContext<SetContext>((_: string) => {}) 10 12 11 - function getInitialFeed() { 13 + function getInitialFeed(startSessionWithFollowing: boolean) { 12 14 if (isWeb) { 13 15 if (window.location.pathname === '/') { 14 16 const params = new URLSearchParams(window.location.search) ··· 24 26 return feedFromSession 25 27 } 26 28 } 27 - const feedFromPersisted = persisted.get('lastSelectedHomeFeed') 28 - if (feedFromPersisted) { 29 - // Fall back to the last chosen one across all tabs. 30 - return feedFromPersisted 29 + if (!startSessionWithFollowing) { 30 + const feedFromPersisted = persisted.get('lastSelectedHomeFeed') 31 + if (feedFromPersisted) { 32 + // Fall back to the last chosen one across all tabs. 33 + return feedFromPersisted 34 + } 31 35 } 32 36 return 'home' 33 37 } 34 38 35 39 export function Provider({children}: React.PropsWithChildren<{}>) { 36 - const [state, setState] = React.useState(getInitialFeed) 40 + const startSessionWithFollowing = useGate('start_session_with_following') 41 + const [state, setState] = React.useState(() => 42 + getInitialFeed(startSessionWithFollowing), 43 + ) 37 44 38 45 const saveState = React.useCallback((feed: string) => { 39 46 setState(feed)