Keep interstitial fresh on refresh (#4888)
parent
00fea10782
commit
a864f69849
|
@ -212,8 +212,9 @@ let Feed = ({
|
||||||
isFetchingNextPage,
|
isFetchingNextPage,
|
||||||
fetchNextPage,
|
fetchNextPage,
|
||||||
} = usePostFeedQuery(feed, feedParams, opts)
|
} = usePostFeedQuery(feed, feedParams, opts)
|
||||||
if (data?.pages[0]) {
|
const lastFetchedAt = data?.pages[0].fetchedAt
|
||||||
lastFetchRef.current = data?.pages[0].fetchedAt
|
if (lastFetchedAt) {
|
||||||
|
lastFetchRef.current = lastFetchedAt
|
||||||
}
|
}
|
||||||
const isEmpty = React.useMemo(
|
const isEmpty = React.useMemo(
|
||||||
() => !isFetching && !data?.pages?.some(page => page.slices.length),
|
() => !isFetching && !data?.pages?.some(page => page.slices.length),
|
||||||
|
@ -358,7 +359,7 @@ let Feed = ({
|
||||||
...interstitial,
|
...interstitial,
|
||||||
params: {variant},
|
params: {variant},
|
||||||
// overwrite key with unique value
|
// overwrite key with unique value
|
||||||
key: [interstitial.type, variant].join(':'),
|
key: [interstitial.type, variant, lastFetchedAt].join(':'),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arr.length > interstitial.slot) {
|
if (arr.length > interstitial.slot) {
|
||||||
|
@ -374,6 +375,7 @@ let Feed = ({
|
||||||
isFetched,
|
isFetched,
|
||||||
isError,
|
isError,
|
||||||
isEmpty,
|
isEmpty,
|
||||||
|
lastFetchedAt,
|
||||||
data,
|
data,
|
||||||
feedUri,
|
feedUri,
|
||||||
feedIsDiscover,
|
feedIsDiscover,
|
||||||
|
|
Loading…
Reference in New Issue