diff options
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/lib/constants.ts | 67 | ||||
-rw-r--r-- | src/state/models/feed-view.ts | 8 | ||||
-rw-r--r-- | src/view/com/posts/Feed.tsx | 4 | ||||
-rw-r--r-- | yarn.lock | 12 |
5 files changed, 89 insertions, 4 deletions
diff --git a/package.json b/package.json index 1f4f5039b..bb6db971f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0", "lodash.omit": "^4.5.0", + "lodash.samplesize": "^4.2.0", "lodash.shuffle": "^4.2.0", "lru_map": "^0.4.1", "mobx": "^6.6.1", @@ -102,6 +103,7 @@ "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.isequal": "^4.5.6", "@types/lodash.omit": "^4.5.7", + "@types/lodash.samplesize": "^4.2.7", "@types/lodash.shuffle": "^4.2.7", "@types/react-avatar-editor": "^13.0.0", "@types/react-native": "^0.67.3", diff --git a/src/lib/constants.ts b/src/lib/constants.ts index a93301b34..31947cd8f 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -30,7 +30,68 @@ export function TEAM_HANDLES(serviceUrl: string) { } export const PROD_SUGGESTED_FOLLOWS = [ + 'christina', + 'wesam', + 'jim', + 'ab', + 'karalabe', + 'clun', + 'staltz', + 'gillian', + 'karpathy', + 'zoink', 'john', + 'round', + 'vex', + 'umang', + 'atroyn', + 'poisonivy', + 'wongmjane', + 'lari', + 'arunwadhwa', + 'trav', + 'fred', + 'offscript', + 'satnam', + 'ella', + 'caspian', + 'spencer', + 'nickgrossman', + 'koji', + 'avy', + 'seymourstein', + 'joelg', + 'stig', + 'rabble', + 'hunterwalk', + 'evan', + 'aviral', + 'tami', + 'generativist', + 'gord', + 'ninjapleasedj', + 'robotics', + 'noahjnelson', + 'vijay', + 'scottbeale', + 'daybreakjung', + 'shelby', + 'joel', + 'space', + 'rish', + 'simon', + 'kelly', + 'maxbittker', + 'sylphrenetic', + 'caleb', + 'jik', + 'james', + 'neil', + 'tippenein', + 'mandel', + 'sharding', + 'tyler', + 'raymond', 'visakanv', 'saz', 'steph', @@ -39,12 +100,17 @@ export const PROD_SUGGESTED_FOLLOWS = [ 'weisser', 'katherine', 'annagat', + 'an', + 'kunal', 'josh', 'lurkshark', 'amir', 'amyxzh', 'danielle', 'jack-frazee', + 'daniellefong', + 'dystopiabreaker', + 'morgan', 'vibes', 'cat', 'yuriy', @@ -63,6 +129,7 @@ export const PROD_SUGGESTED_FOLLOWS = [ 'jennijuju', 'ian5v', 'bnewbold', + 'jasmine', 'chris', 'mtclai', 'willscott', diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts index ed5a32d8f..fe0943018 100644 --- a/src/state/models/feed-view.ts +++ b/src/state/models/feed-view.ts @@ -7,6 +7,7 @@ import { } from '@atproto/api' import AwaitLock from 'await-lock' import {bundleAsync} from 'lib/async/bundle' +import sampleSize from 'lodash.samplesize' type FeedViewPost = AppBskyFeedFeedViewPost.Main type ReasonRepost = AppBskyFeedFeedViewPost.ReasonRepost type PostView = AppBskyFeedPost.View @@ -425,7 +426,7 @@ export class FeedModel { * Check if new posts are available */ async checkForLatest() { - if (this.hasNewLatest) { + if (this.hasNewLatest || this.rootStore.me.follows.isEmpty) { return } const res = await this._getFeed({limit: 1}) @@ -565,7 +566,10 @@ export class FeedModel { if (this.rootStore.me.follows.isEmpty) { const responses = await getMultipleAuthorsPosts( this.rootStore, - SUGGESTED_FOLLOWS(String(this.rootStore.agent.service)), + sampleSize( + SUGGESTED_FOLLOWS(String(this.rootStore.agent.service)), + 20, + ), params.before, 20, ) diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index a4963e0d6..7ed6bc711 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -78,11 +78,11 @@ export const Feed = observer(function Feed({ // = const checkWelcome = React.useCallback(async () => { - if (showWelcomeBanner) { + if (showWelcomeBanner && store.me.did) { await store.me.follows.fetchIfNeeded() setIsNewUser(store.me.follows.isEmpty) } - }, [showWelcomeBanner, store.me.follows]) + }, [showWelcomeBanner, store.me.follows, store.me.did]) React.useEffect(() => { checkWelcome() }, [checkWelcome]) diff --git a/yarn.lock b/yarn.lock index 6583e0a9a..de326be4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2833,6 +2833,13 @@ dependencies: "@types/lodash" "*" +"@types/lodash.samplesize@^4.2.7": + version "4.2.7" + resolved "https://registry.yarnpkg.com/@types/lodash.samplesize/-/lodash.samplesize-4.2.7.tgz#15784dd9e54aa1bf043552bdb533b83fcf50b82f" + integrity sha512-l4nPeq7tew/T/4zKvVvjR0r4XyDaeTGGSGrdXsjH64LbWsosZBo9/zGpAIBjAH2nKZwZ8fHZ5alhaIZu5LLwmg== + dependencies: + "@types/lodash" "*" + "@types/lodash.shuffle@^4.2.7": version "4.2.7" resolved "https://registry.yarnpkg.com/@types/lodash.shuffle/-/lodash.shuffle-4.2.7.tgz#b714d829af948a266b0df1477d629c70de2f4c72" @@ -8999,6 +9006,11 @@ lodash.once@^4.0.0: resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg== +lodash.samplesize@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.samplesize/-/lodash.samplesize-4.2.0.tgz#460762fbb2b342290517499e90d51586db465ff9" + integrity sha512-1ZhKV7/nuISuaQdxfCqrs4HHxXIYN+0Z4f7NMQn2PHkxFZJGavJQ1j/paxyJnLJmN2ZamNN6SMepneV+dCgQTA== + lodash.shuffle@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.shuffle/-/lodash.shuffle-4.2.0.tgz#145b5053cf875f6f5c2a33f48b6e9948c6ec7b4b" |