Skip to content

Commit abd28fb

Browse files
authored
Merge pull request #81 from k4m2a/fix/pin-brand-feed-onboarding
Pin brand default feeds when finishing onboarding
2 parents a2b6f2e + 8af52c2 commit abd28fb

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

src/screens/Onboarding/useFinishOnboarding.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,33 @@ export function useFinishOnboarding() {
103103
})(),
104104
(async () => {
105105
/*
106-
* Default feeds are seeded at account creation; only rewrite them
107-
* when starter-pack feeds need to be appended.
106+
* Authoritatively pin the brand default feeds (brand feed +
107+
* following), plus any starter-pack feeds. Feeds are also seeded at
108+
* account creation, but that can be lost: if no savedFeedsPrefV2
109+
* exists yet, the first getPreferences() synthesizes and persists a
110+
* following-only default, permanently dropping the brand feed. This
111+
* runs late (after the session is live) and unconditionally, so it
112+
* reliably restores the brand feed regardless of that race.
108113
*/
109-
if (starterPack && starterPack.feeds?.length) {
110-
const feedsToSave: AppBskyActorDefs.SavedFeed[] = [
111-
{
112-
...DISCOVER_SAVED_FEED,
113-
id: TID.nextStr(),
114-
},
115-
{
116-
...TIMELINE_SAVED_FEED,
117-
id: TID.nextStr(),
118-
},
119-
...starterPack.feeds.map(f => ({
120-
type: 'feed',
121-
value: f.uri,
122-
pinned: true,
123-
id: TID.nextStr(),
124-
})),
125-
]
126-
await agent.overwriteSavedFeeds(feedsToSave)
127-
}
114+
const feedsToSave: AppBskyActorDefs.SavedFeed[] = [
115+
{
116+
...DISCOVER_SAVED_FEED,
117+
id: TID.nextStr(),
118+
},
119+
{
120+
...TIMELINE_SAVED_FEED,
121+
id: TID.nextStr(),
122+
},
123+
...(starterPack?.feeds?.length
124+
? starterPack.feeds.map(f => ({
125+
type: 'feed',
126+
value: f.uri,
127+
pinned: true,
128+
id: TID.nextStr(),
129+
}))
130+
: []),
131+
]
132+
await agent.overwriteSavedFeeds(feedsToSave)
128133
})(),
129134
(async () => {
130135
const {imageUri, imageMime} = profileStepResults

0 commit comments

Comments
 (0)