More notifications improvements (#2198)

* On mobile, never replace the notifs under the user due to focus events

* Use the server's seenAt response to calculate isRead state locally
This commit is contained in:
Paul Frazee 2023-12-13 12:16:55 -08:00 committed by GitHub
parent eecf04489f
commit e3ba014be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 29 deletions

View file

@ -67,8 +67,8 @@ export function NotificationsScreen({}: Props) {
const onFocusCheckLatest = React.useCallback(() => {
// on focus, check for latest, but only invalidate if the user
// isnt scrolled down to avoid moving content underneath them
unreadApi.checkUnread({invalidate: !isScrolledDown})
}, [unreadApi, isScrolledDown])
unreadApi.checkUnread({invalidate: !isScrolledDown && isDesktop})
}, [unreadApi, isScrolledDown, isDesktop])
checkLatestRef.current = onFocusCheckLatest
// on-visible setup