diff --git a/src/state/cache/thread-mutes.tsx b/src/state/cache/thread-mutes.tsx index f0d9911348..17f6be9f34 100644 --- a/src/state/cache/thread-mutes.tsx +++ b/src/state/cache/thread-mutes.tsx @@ -5,9 +5,11 @@ import { useEffect, useState, } from 'react' +import {type AtUriString} from '@atproto/syntax' import * as persisted from '#/state/persisted' -import {useAgent, useSession} from '../session' +import {app} from '#/lexicons' +import {useAppviewClient, useSession} from '../session' type StateContext = Map type SetStateContext = (uri: string, value: boolean) => void @@ -56,7 +58,7 @@ export function useSetThreadMute() { } function useMigrateMutes(setThreadMute: SetStateContext) { - const agent = useAgent() + const client = useAppviewClient() const {currentAccount} = useSession() useEffect(() => { @@ -87,8 +89,11 @@ function useMigrateMutes(setThreadMute: SetStateContext) { setThreadMute(root, true) - await agent.api.app.bsky.graph - .muteThread({root}) + await client + .call(app.bsky.graph.muteThread, { + // the persisted list only ever holds post at-uris + root: root as AtUriString, + }) // not a big deal if this fails, since the post might have been deleted .catch(console.error) } @@ -100,5 +105,5 @@ function useMigrateMutes(setThreadMute: SetStateContext) { cancelled = true } } - }, [agent, currentAccount, setThreadMute]) + }, [client, currentAccount, setThreadMute]) }