Maintain some feed data to avoid needless glimmers (#2054)
This commit is contained in:
parent
9fa90bb8d9
commit
826cbbd4bf
11 changed files with 40 additions and 23 deletions
|
@ -53,6 +53,7 @@ import {emitSoftReset} from '#/state/events'
|
|||
import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
||||
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
||||
import {truncateAndInvalidate} from '#/state/queries/util'
|
||||
|
||||
export function DrawerProfileCard({
|
||||
account,
|
||||
|
@ -141,9 +142,7 @@ export function DrawerContent() {
|
|||
} else {
|
||||
if (tab === 'Notifications') {
|
||||
// fetch new notifs on view
|
||||
queryClient.resetQueries({
|
||||
queryKey: NOTIFS_RQKEY(),
|
||||
})
|
||||
truncateAndInvalidate(queryClient, NOTIFS_RQKEY())
|
||||
}
|
||||
// @ts-ignore must be Home, Search, Notifications, or MyProfile
|
||||
navigation.navigate(`${tab}Tab`)
|
||||
|
|
|
@ -32,6 +32,7 @@ import {emitSoftReset} from '#/state/events'
|
|||
import {useSession} from '#/state/session'
|
||||
import {useProfileQuery} from '#/state/queries/profile'
|
||||
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
||||
import {truncateAndInvalidate} from '#/state/queries/util'
|
||||
|
||||
type TabOptions = 'Home' | 'Search' | 'Notifications' | 'MyProfile' | 'Feeds'
|
||||
|
||||
|
@ -62,9 +63,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
|||
} else {
|
||||
if (tab === 'Notifications') {
|
||||
// fetch new notifs on view
|
||||
queryClient.resetQueries({
|
||||
queryKey: NOTIFS_RQKEY(),
|
||||
})
|
||||
truncateAndInvalidate(queryClient, NOTIFS_RQKEY())
|
||||
}
|
||||
navigation.navigate(`${tab}Tab`)
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ 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()
|
||||
|
@ -150,9 +151,7 @@ function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {
|
|||
} else {
|
||||
if (href === '/notifications') {
|
||||
// fetch new notifs on view
|
||||
queryClient.resetQueries({
|
||||
queryKey: NOTIFS_RQKEY(),
|
||||
})
|
||||
truncateAndInvalidate(queryClient, NOTIFS_RQKEY())
|
||||
}
|
||||
onPress()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue