Stop using the cached notification page (#2142)

zio/stable
Paul Frazee 2023-12-07 17:16:39 -08:00 committed by GitHub
parent 7de5c341a9
commit 448a403c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 14 deletions

View File

@ -60,20 +60,13 @@ export function useNotificationFeedQuery(opts?: {enabled?: boolean}) {
staleTime: STALE.INFINITY, staleTime: STALE.INFINITY,
queryKey: RQKEY(), queryKey: RQKEY(),
async queryFn({pageParam}: {pageParam: RQPageParam}) { async queryFn({pageParam}: {pageParam: RQPageParam}) {
let page let page = await fetchPage({
if (!pageParam) { limit: PAGE_SIZE,
// for the first page, we check the cached page held by the unread-checker first cursor: pageParam,
page = unreads.getCachedUnreadPage() queryClient,
} moderationOpts,
if (!page) { threadMutes,
page = await fetchPage({ })
limit: PAGE_SIZE,
cursor: pageParam,
queryClient,
moderationOpts,
threadMutes,
})
}
// if the first page has an unread, mark all read // if the first page has an unread, mark all read
if (!pageParam && page.items[0] && !page.items[0].notification.isRead) { if (!pageParam && page.items[0] && !page.items[0].notification.isRead) {