Stop using the cached notification page (#2142)
parent
7de5c341a9
commit
448a403c81
|
@ -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) {
|
|
||||||
// for the first page, we check the cached page held by the unread-checker first
|
|
||||||
page = unreads.getCachedUnreadPage()
|
|
||||||
}
|
|
||||||
if (!page) {
|
|
||||||
page = await fetchPage({
|
|
||||||
limit: PAGE_SIZE,
|
limit: PAGE_SIZE,
|
||||||
cursor: pageParam,
|
cursor: pageParam,
|
||||||
queryClient,
|
queryClient,
|
||||||
moderationOpts,
|
moderationOpts,
|
||||||
threadMutes,
|
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) {
|
||||||
|
|
Loading…
Reference in New Issue