diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx
index e9d26a4c67..aa189173b4 100644
--- a/src/screens/Onboarding/StepFinished.tsx
+++ b/src/screens/Onboarding/StepFinished.tsx
@@ -102,6 +102,7 @@ export function StepFinished() {
initialFeed: 'following',
})
}
+ console.log('ADDING PACK')
addUsedStarterPack(makeStarterPackLink(starterPack))
}
})(),
diff --git a/src/screens/StarterPack/StarterPackLandingScreen.tsx b/src/screens/StarterPack/StarterPackLandingScreen.tsx
index d3da521e27..8242d283d3 100644
--- a/src/screens/StarterPack/StarterPackLandingScreen.tsx
+++ b/src/screens/StarterPack/StarterPackLandingScreen.tsx
@@ -287,6 +287,20 @@ function LandingScreenInner({
)}
+
(undefined)
const setContext = React.createContext((_: StateContext) => {})
export function Provider({children}: {children: React.ReactNode}) {
- const [state, setState] = React.useState()
+ const [state, setState] = React.useState(() =>
+ persisted.get('currentStarterPack'),
+ )
const setStateWrapped = (v: StateContext) => {
setState(v)
diff --git a/src/state/preferences/used-starter-packs.tsx b/src/state/preferences/used-starter-packs.tsx
index 65429b9169..ebd2525fea 100644
--- a/src/state/preferences/used-starter-packs.tsx
+++ b/src/state/preferences/used-starter-packs.tsx
@@ -9,9 +9,12 @@ const stateContext = React.createContext([])
const setContext = React.createContext((_: string) => {})
export function Provider({children}: {children: React.ReactNode}) {
- const [state, setState] = React.useState([])
+ const [state, setState] = React.useState(() =>
+ persisted.get('usedStarterPacks'),
+ )
const setStateWrapped = (v: string) => {
+ console.log('ADDING!!!', v)
persisted.write('usedStarterPacks', [...(state ? state : []), v])
setState(prev => [...(prev ? prev : []), v])
}
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
index ef7e962d15..333b648bea 100644
--- a/src/view/screens/Home.tsx
+++ b/src/view/screens/Home.tsx
@@ -26,6 +26,7 @@ import {
useCurrentStarterPack,
useSetCurrentStarterPack,
} from 'state/preferences/starter-pack'
+import {useUsedStarterPacks} from 'state/preferences/used-starter-packs'
import {useLoggedOutViewControls} from 'state/shell/logged-out'
import {FeedPage} from 'view/com/feeds/FeedPage'
import {Pager, PagerRef, RenderTabBarFnProps} from 'view/com/pager/Pager'
@@ -41,18 +42,27 @@ export function HomeScreen(props: Props) {
const {data: pinnedFeedInfos, isLoading: isPinnedFeedsLoading} =
usePinnedFeedsInfos()
const currentStarterPack = useCurrentStarterPack()
+ const usedStarterPacks = useUsedStarterPacks()
const {setShowLoggedOut, requestSwitchToAccount} = useLoggedOutViewControls()
React.useEffect(() => {
if (currentStarterPack && !currentStarterPack?.initialFeed) {
- setShowLoggedOut(true)
- requestSwitchToAccount({requestedAccount: 'starterpack'})
+ // In test environments, the URL won't start with `https://bsky.app`, so we want to find it by the route
+ try {
+ const route = new URL(currentStarterPack.uri).pathname
+ const foundIndex = usedStarterPacks?.findIndex(p => p.includes(route))
+ if (foundIndex === -1) {
+ setShowLoggedOut(true)
+ requestSwitchToAccount({requestedAccount: 'starterpack'})
+ }
+ } catch {}
}
}, [
setShowLoggedOut,
requestSwitchToAccount,
currentStarterPack?.initialFeed,
currentStarterPack,
+ usedStarterPacks,
])
if (preferences && pinnedFeedInfos && !isPinnedFeedsLoading) {
@@ -103,6 +113,10 @@ function HomeScreenReady({
const lastPagerReportedIndexRef = React.useRef(selectedIndex)
React.useLayoutEffect(() => {
let initialIndex = selectedIndex
+ console.log(
+ 'currentStarterPack.initialFeed',
+ currentStarterPack?.initialFeed,
+ )
if (currentStarterPack?.initialFeed) {
if (currentStarterPack.initialFeed === 'following') {
initialIndex = 1