diff options
author | dan <dan.abramov@gmail.com> | 2024-05-28 16:37:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 16:37:51 +0100 |
commit | 9bd411c15159609803c4e8c3e352a9db32ea527c (patch) | |
tree | 31305e290bd4597aa6ab441ecc556999b19ad693 /src/state/queries/notifications/unread.tsx | |
parent | 8a2f43c218c464e6165f331e482b6094b87eefc7 (diff) | |
download | voidsky-9bd411c15159609803c4e8c3e352a9db32ea527c.tar.zst |
Replace getAgent() with reading agent (#4243)
* Replace getAgent() with agent * Replace {agent} with agent
Diffstat (limited to 'src/state/queries/notifications/unread.tsx')
-rw-r--r-- | src/state/queries/notifications/unread.tsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index acc68c360..5f33cdf74 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -45,7 +45,7 @@ const apiContext = React.createContext<ApiContext>({ export function Provider({children}: React.PropsWithChildren<{}>) { const {hasSession} = useSession() - const {getAgent} = useAgent() + const agent = useAgent() const queryClient = useQueryClient() const moderationOpts = useModerationOpts() const threadMutes = useMutedThreads() @@ -112,7 +112,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { return { async markAllRead() { // update server - await getAgent().updateSeenNotifications( + await agent.updateSeenNotifications( cacheRef.current.syncedAt.toISOString(), ) @@ -127,7 +127,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { isPoll, }: {invalidate?: boolean; isPoll?: boolean} = {}) { try { - if (!getAgent().session) return + if (!agent.session) return if (AppState.currentState !== 'active') { return } @@ -142,7 +142,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { // count const {page, indexedAt: lastIndexed} = await fetchPage({ - getAgent, + agent, cursor: undefined, limit: 40, queryClient, @@ -192,7 +192,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { } }, } - }, [setNumUnread, queryClient, moderationOpts, threadMutes, getAgent]) + }, [setNumUnread, queryClient, moderationOpts, threadMutes, agent]) checkUnreadRef.current = api.checkUnread return ( |