diff options
author | dan <dan.abramov@gmail.com> | 2024-08-08 06:20:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 06:20:24 +0100 |
commit | a864f69849387f0dd69251fda92e4e569bd17e94 (patch) | |
tree | bef07258696d753c3c7e6216f95fcf3291f49432 /src | |
parent | 00fea10782676e3bcf7027ca3d037dcf82a25b99 (diff) | |
download | voidsky-a864f69849387f0dd69251fda92e4e569bd17e94.tar.zst |
Keep interstitial fresh on refresh (#4888)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/posts/Feed.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index aa45d3acc..ef4633319 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -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), @@ -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) { @@ -374,6 +375,7 @@ let Feed = ({ isFetched, isError, isEmpty, + lastFetchedAt, data, feedUri, feedIsDiscover, |