Skip to content

Commit

Permalink
Revert "Prefetch adjacent Home pages (#6904)"
Browse files Browse the repository at this point in the history
This reverts commit 1170261.
  • Loading branch information
gaearon committed Dec 8, 2024
1 parent d1cdc66 commit da56ef7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/view/com/feeds/FeedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const POLL_FREQ = 60e3 // 60sec
export function FeedPage({
testID,
isPageFocused,
isPageAdjacent,
feed,
feedParams,
renderEmptyState,
Expand All @@ -43,7 +42,6 @@ export function FeedPage({
feed: FeedDescriptor
feedParams?: FeedParams
isPageFocused: boolean
isPageAdjacent: boolean
renderEmptyState: () => JSX.Element
renderEndOfFeed?: () => JSX.Element
savedFeedConfig?: AppBskyActorDefs.SavedFeed
Expand Down Expand Up @@ -113,11 +111,11 @@ export function FeedPage({
<FeedFeedbackProvider value={feedFeedback}>
<Feed
testID={testID ? `${testID}-feed` : undefined}
enabled={isPageFocused || isPageAdjacent}
enabled={isPageFocused}
feed={feed}
feedParams={feedParams}
pollInterval={POLL_FREQ}
disablePoll={hasNew || !isPageFocused}
disablePoll={hasNew}
scrollElRef={scrollElRef}
onScrolledDownChange={setIsScrolledDown}
onHasNew={setHasNew}
Expand Down
4 changes: 2 additions & 2 deletions src/view/com/posts/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ let Feed = ({
checkForNewRef.current = checkForNew
}, [checkForNew])
React.useEffect(() => {
if (enabled && !disablePoll) {
if (enabled) {
const timeSinceFirstLoad = Date.now() - lastFetchRef.current
// DISABLED need to check if this is causing random feed refreshes -prf
/*if (timeSinceFirstLoad > REFRESH_AFTER) {
Expand All @@ -231,7 +231,7 @@ let Feed = ({
checkForNewRef.current()
}
}
}, [enabled, disablePoll, feed, queryClient, scrollElRef])
}, [enabled, feed, queryClient, scrollElRef])
React.useEffect(() => {
let cleanup1: () => void | undefined, cleanup2: () => void | undefined
const subscription = AppState.addEventListener('change', nextAppState => {
Expand Down
5 changes: 1 addition & 4 deletions src/view/screens/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,14 @@ function HomeScreenReady({
onPageScrollStateChanged={onPageScrollStateChanged}
renderTabBar={renderTabBar}>
{pinnedFeedInfos.length ? (
pinnedFeedInfos.map((feedInfo, index) => {
pinnedFeedInfos.map(feedInfo => {
const feed = feedInfo.feedDescriptor
if (feed === 'following') {
return (
<FeedPage
key={feed}
testID="followingFeedPage"
isPageFocused={selectedFeed === feed}
isPageAdjacent={Math.abs(selectedIndex - index) === 1}
feed={feed}
feedParams={homeFeedParams}
renderEmptyState={renderFollowingEmptyState}
Expand All @@ -255,7 +254,6 @@ function HomeScreenReady({
key={feed}
testID="customFeedPage"
isPageFocused={selectedFeed === feed}
isPageAdjacent={Math.abs(selectedIndex - index) === 1}
feed={feed}
renderEmptyState={renderCustomFeedEmptyState}
savedFeedConfig={savedFeedConfig}
Expand All @@ -275,7 +273,6 @@ function HomeScreenReady({
<FeedPage
testID="customFeedPage"
isPageFocused
isPageAdjacent={false}
feed={`feedgen|${PROD_DEFAULT_FEED('whats-hot')}`}
renderEmptyState={renderCustomFeedEmptyState}
/>
Expand Down

0 comments on commit da56ef7

Please sign in to comment.