Multiple notifications fixes (#2154)
* Dont reset notifications feed on push notification event * Dont separate notifications by read state to avoid jank * On notifications screen focus, check latest and only rerender if not scrolled down * Reuse the cached notifs page when its not stale * Bump ios build number * Improve comments * Change the 'mark all read' condition to avoid firing too early
This commit is contained in:
parent
d854e88218
commit
6b3eb401b0
12 changed files with 162 additions and 146 deletions
|
@ -45,10 +45,7 @@ import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
|||
import {useComposerControls} from '#/state/shell/composer'
|
||||
import {useFetchHandle} from '#/state/queries/handle'
|
||||
import {emitSoftReset} from '#/state/events'
|
||||
import {useQueryClient} from '@tanstack/react-query'
|
||||
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
||||
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
||||
import {truncateAndInvalidate} from '#/state/queries/util'
|
||||
|
||||
function ProfileCard() {
|
||||
const {currentAccount} = useSession()
|
||||
|
@ -123,7 +120,6 @@ interface NavItemProps {
|
|||
}
|
||||
function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {
|
||||
const pal = usePalette('default')
|
||||
const queryClient = useQueryClient()
|
||||
const {currentAccount} = useSession()
|
||||
const {isDesktop, isTablet} = useWebMediaQueries()
|
||||
const [pathName] = React.useMemo(() => router.matchPath(href), [href])
|
||||
|
@ -149,14 +145,10 @@ function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {
|
|||
if (isCurrent) {
|
||||
emitSoftReset()
|
||||
} else {
|
||||
if (href === '/notifications') {
|
||||
// fetch new notifs on view
|
||||
truncateAndInvalidate(queryClient, NOTIFS_RQKEY())
|
||||
}
|
||||
onPress()
|
||||
}
|
||||
},
|
||||
[onPress, isCurrent, queryClient, href],
|
||||
[onPress, isCurrent],
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue