Skip to content

Commit bf5237c

Browse files
[Web] Bump desktop trending/feed loadMorePageSize to 10
The shared default (`TRENDING_LOAD_MORE_PAGE_SIZE` / `FEED_LOAD_MORE_PAGE_SIZE = 4`) is tuned for mobile viewports and slower touch scrolling. On desktop a fast trackpad / wheel scroll covers ~2 viewports per second, but each 4-track page only adds ~480px of real content — so successive load-mores can't keep up and the lineup visibly lags behind the user even with the synchronous skeleton tail. Override at the desktop call sites only, leaving the shared constant (and mobile's behavior) untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 79d00e0 commit bf5237c

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

packages/web/src/pages/feed-page/components/desktop/FeedPageContent.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ import { useMemo, useRef } from 'react'
33
import {
44
getFeedQueryKey,
55
FEED_INITIAL_PAGE_SIZE,
6-
FEED_LOAD_MORE_PAGE_SIZE,
76
useCurrentUserId,
87
useFeed,
98
useForYouFeed,
10-
FOR_YOU_INITIAL_PAGE_SIZE,
11-
FOR_YOU_LOAD_MORE_PAGE_SIZE
9+
FOR_YOU_INITIAL_PAGE_SIZE
1210
} from '@audius/common/api'
1311
import { Name, FeedFilter, FeedTab } from '@audius/common/models'
1412
import {
@@ -56,6 +54,11 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => {
5654
const feedTab = useSelector(getFeedTab)
5755
const { data: currentUserId } = useCurrentUserId()
5856

57+
// Desktop viewports + fast trackpad / wheel scroll need bigger pages than
58+
// the shared default (mobile-tuned) so successive load-mores keep up with a
59+
// user scrolling deep into the lineup.
60+
const desktopLoadMorePageSize = 10
61+
5962
const isForYou = feedTab === FeedTab.FOR_YOU
6063
const followingFilter = isForYou
6164
? FeedFilter.ALL
@@ -67,7 +70,7 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => {
6770
userId: currentUserId,
6871
filter: followingFilter,
6972
initialPageSize: FEED_INITIAL_PAGE_SIZE,
70-
loadMorePageSize: FEED_LOAD_MORE_PAGE_SIZE
73+
loadMorePageSize: desktopLoadMorePageSize
7174
}),
7275
[followingFilter, currentUserId]
7376
)
@@ -77,7 +80,7 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => {
7780
const forYouFeed = useForYouFeed(
7881
{
7982
initialPageSize: FOR_YOU_INITIAL_PAGE_SIZE,
80-
loadMorePageSize: FOR_YOU_LOAD_MORE_PAGE_SIZE
83+
loadMorePageSize: desktopLoadMorePageSize
8184
},
8285
{ enabled: isForYou }
8386
)
@@ -115,7 +118,7 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => {
115118
isError: forYouFeed.isError,
116119
hasNextPage: forYouFeed.hasNextPage,
117120
loadNextPage: forYouFeed.loadNextPage,
118-
pageSize: FOR_YOU_LOAD_MORE_PAGE_SIZE,
121+
pageSize: desktopLoadMorePageSize,
119122
initialPageSize: FOR_YOU_INITIAL_PAGE_SIZE,
120123
querySource: undefined
121124
}
@@ -126,7 +129,7 @@ const FeedPageContent = ({ containerRef }: FeedPageContentProps) => {
126129
isError: followFeed.isError,
127130
hasNextPage: followFeed.hasNextPage,
128131
loadNextPage: followFeed.loadNextPage,
129-
pageSize: FEED_LOAD_MORE_PAGE_SIZE,
132+
pageSize: desktopLoadMorePageSize,
130133
initialPageSize: FEED_INITIAL_PAGE_SIZE,
131134
querySource: followQuerySource
132135
}

packages/web/src/pages/trending-page/components/desktop/TrendingPageContent.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
getTrendingQueryKey,
55
getTrendingUndergroundQueryKey,
66
TRENDING_INITIAL_PAGE_SIZE,
7-
TRENDING_LOAD_MORE_PAGE_SIZE,
87
useTrending,
98
useTrendingUnderground
109
} from '@audius/common/api'
@@ -106,11 +105,16 @@ const TrendingPageContent = ({ containerRef }: TrendingPageContentProps) => {
106105
const trendingGenre = useSelector(getTrendingGenre)
107106
const trendingTimeRange = useSelector(getTrendingTimeRange)
108107

108+
// Desktop viewports + fast trackpad / wheel scroll need bigger pages than
109+
// the shared default (mobile-tuned) so successive load-mores keep up with a
110+
// user scrolling deep into the lineup.
111+
const desktopLoadMorePageSize = 10
112+
109113
// ----- Three tanquery streams, one per time range -----
110114
const trendingArgs = useMemo(
111115
() => ({
112116
initialPageSize: TRENDING_INITIAL_PAGE_SIZE,
113-
loadMorePageSize: TRENDING_LOAD_MORE_PAGE_SIZE,
117+
loadMorePageSize: desktopLoadMorePageSize,
114118
genre: trendingGenre
115119
}),
116120
[trendingGenre]
@@ -401,7 +405,7 @@ const TrendingPageContent = ({ containerRef }: TrendingPageContentProps) => {
401405
isError={q.isError}
402406
hasNextPage={q.hasNextPage}
403407
loadNextPage={q.loadNextPage}
404-
pageSize={TRENDING_LOAD_MORE_PAGE_SIZE}
408+
pageSize={desktopLoadMorePageSize}
405409
initialPageSize={TRENDING_INITIAL_PAGE_SIZE}
406410
scrollParent={containerRef?.current ?? null}
407411
endOfLineupElement={

0 commit comments

Comments
 (0)