migrate the thread mute backfill to the appview client

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 19:38:27 +03:00
parent 8f6181495e
commit 88477d0767
+10 -5
View File
@@ -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<string, boolean>
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])
}