Skip to content

Commit

Permalink
Keep interstitial fresh on refresh (bluesky-social#4888)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Aug 8, 2024
1 parent 00fea10 commit a864f69
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/view/com/posts/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ let Feed = ({
isFetchingNextPage,
fetchNextPage,
} = usePostFeedQuery(feed, feedParams, opts)
if (data?.pages[0]) {
lastFetchRef.current = data?.pages[0].fetchedAt
const lastFetchedAt = data?.pages[0].fetchedAt
if (lastFetchedAt) {
lastFetchRef.current = lastFetchedAt
}
const isEmpty = React.useMemo(
() => !isFetching && !data?.pages?.some(page => page.slices.length),
Expand Down Expand Up @@ -358,7 +359,7 @@ let Feed = ({
...interstitial,
params: {variant},
// overwrite key with unique value
key: [interstitial.type, variant].join(':'),
key: [interstitial.type, variant, lastFetchedAt].join(':'),
}

if (arr.length > interstitial.slot) {
Expand All @@ -374,6 +375,7 @@ let Feed = ({
isFetched,
isError,
isEmpty,
lastFetchedAt,
data,
feedUri,
feedIsDiscover,
Expand Down

0 comments on commit a864f69

Please sign in to comment.