Fix notification mark-read behaviors (#2696)
* Mark read on first notifs page fetch always; this is less optimal but it fixes a case where when the first full page's unreads are all filtered out * Use the pre-filter indexedAt for updateSeen
This commit is contained in:
@@ -127,7 +127,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
}
|
||||
|
||||
// count
|
||||
const page = await fetchPage({
|
||||
const {page, indexedAt: lastIndexed} = await fetchPage({
|
||||
cursor: undefined,
|
||||
limit: 40,
|
||||
queryClient,
|
||||
@@ -151,12 +151,14 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
|
||||
// track last sync
|
||||
const now = new Date()
|
||||
const lastIndexed =
|
||||
page.items[0] && new Date(page.items[0].notification.indexedAt)
|
||||
const lastIndexedDate = lastIndexed
|
||||
? new Date(lastIndexed)
|
||||
: undefined
|
||||
cacheRef.current = {
|
||||
usableInFeed: !!invalidate, // will be used immediately
|
||||
data: page,
|
||||
syncedAt: !lastIndexed || now > lastIndexed ? now : lastIndexed,
|
||||
syncedAt:
|
||||
!lastIndexedDate || now > lastIndexedDate ? now : lastIndexedDate,
|
||||
unreadCount,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user