Skip to content

Commit e4c11ea

Browse files
Fix token activity feed query invalidation
1 parent ea786f4 commit e4c11ea

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/app/features/home/TokenActivityFeed.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Events } from 'app/utils/zod/activity/events'
1414
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
1515
import type { ZodError } from 'zod'
1616
import { TokenActivityRow } from './TokenActivityRow'
17+
import { useRootScreenParams } from 'app/routers/params'
1718

1819
export const TokenActivityFeed = ({
1920
tokenActivityFeedQuery,
@@ -31,6 +32,7 @@ export const TokenActivityFeed = ({
3132
const media = useMedia()
3233
const queryClient = useQueryClient()
3334
const wasPendingRef = useRef(false) // Ref to track if a pending activity was seen previously
35+
const [queryParams] = useRootScreenParams()
3436

3537
const layoutSizeAdjustment = media.gtLg ? 32 : 14
3638

@@ -74,12 +76,15 @@ export const TokenActivityFeed = ({
7476
// If it was pending previously but isn't anymore, invalidate the activity feed query
7577
if (wasPendingRef.current && !isCurrentlyPending) {
7678
// Invalidate the query
77-
queryClient.invalidateQueries({ queryKey: ['activity_feed'] })
79+
queryClient.invalidateQueries({
80+
queryKey: ['token_activity_feed', { address: queryParams.token }],
81+
exact: false,
82+
})
7883
}
7984

8085
// Update the ref to store the current pending state for the next effect run
8186
wasPendingRef.current = isCurrentlyPending
82-
}, [data, queryClient])
87+
}, [data, queryClient, queryParams.token])
8388

8489
const [dataProvider, setDataProvider] = useState(dataProviderMaker(activities))
8590

packages/app/features/send/confirm/screen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ export function SendConfirm() {
227227
if (workflowId) {
228228
await queryClient.invalidateQueries({
229229
queryKey: ['token_activity_feed', { address: selectedCoin.token }],
230+
exact: false,
230231
})
231232
router.replace({ pathname: '/', query: { token: sendToken } })
232233
}

0 commit comments

Comments
 (0)