Drill getAgent instead
This commit is contained in:
@@ -87,7 +87,7 @@ export function useListCreateMutation() {
|
|||||||
|
|
||||||
// wait for the appview to update
|
// wait for the appview to update
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
getAgent(),
|
getAgent,
|
||||||
res.uri,
|
res.uri,
|
||||||
(v: AppBskyGraphGetList.Response) => {
|
(v: AppBskyGraphGetList.Response) => {
|
||||||
return typeof v?.data?.list.uri === 'string'
|
return typeof v?.data?.list.uri === 'string'
|
||||||
@@ -156,7 +156,7 @@ export function useListMetadataMutation() {
|
|||||||
|
|
||||||
// wait for the appview to update
|
// wait for the appview to update
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
getAgent(),
|
getAgent,
|
||||||
res.uri,
|
res.uri,
|
||||||
(v: AppBskyGraphGetList.Response) => {
|
(v: AppBskyGraphGetList.Response) => {
|
||||||
const list = v.data.list
|
const list = v.data.list
|
||||||
@@ -230,7 +230,7 @@ export function useListDeleteMutation() {
|
|||||||
|
|
||||||
// wait for the appview to update
|
// wait for the appview to update
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
getAgent(),
|
getAgent,
|
||||||
uri,
|
uri,
|
||||||
(v: AppBskyGraphGetList.Response) => {
|
(v: AppBskyGraphGetList.Response) => {
|
||||||
return !v?.success
|
return !v?.success
|
||||||
@@ -258,7 +258,7 @@ export function useListMuteMutation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
getAgent(),
|
getAgent,
|
||||||
uri,
|
uri,
|
||||||
(v: AppBskyGraphGetList.Response) => {
|
(v: AppBskyGraphGetList.Response) => {
|
||||||
return Boolean(v?.data.list.viewer?.muted) === mute
|
return Boolean(v?.data.list.viewer?.muted) === mute
|
||||||
@@ -284,7 +284,7 @@ export function useListBlockMutation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
getAgent(),
|
getAgent,
|
||||||
uri,
|
uri,
|
||||||
(v: AppBskyGraphGetList.Response) => {
|
(v: AppBskyGraphGetList.Response) => {
|
||||||
return block
|
return block
|
||||||
@@ -302,7 +302,7 @@ export function useListBlockMutation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenAppViewReady(
|
async function whenAppViewReady(
|
||||||
agent: BskyAgent,
|
getAgent: () => BskyAgent,
|
||||||
uri: string,
|
uri: string,
|
||||||
fn: (res: AppBskyGraphGetList.Response) => boolean,
|
fn: (res: AppBskyGraphGetList.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
@@ -311,7 +311,7 @@ async function whenAppViewReady(
|
|||||||
1e3, // 1s delay between tries
|
1e3, // 1s delay between tries
|
||||||
fn,
|
fn,
|
||||||
() =>
|
() =>
|
||||||
agent.app.bsky.graph.getList({
|
getAgent().app.bsky.graph.getList({
|
||||||
list: uri,
|
list: uri,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ export function useProfileUpdateMutation() {
|
|||||||
return existing
|
return existing
|
||||||
})
|
})
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
getAgent(),
|
getAgent,
|
||||||
profile.did,
|
profile.did,
|
||||||
checkCommitted ||
|
checkCommitted ||
|
||||||
(res => {
|
(res => {
|
||||||
@@ -518,7 +518,7 @@ export function precacheThreadPostProfiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenAppViewReady(
|
async function whenAppViewReady(
|
||||||
agent: BskyAgent,
|
getAgent: () => BskyAgent,
|
||||||
actor: string,
|
actor: string,
|
||||||
fn: (res: AppBskyActorGetProfile.Response) => boolean,
|
fn: (res: AppBskyActorGetProfile.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
@@ -526,7 +526,7 @@ async function whenAppViewReady(
|
|||||||
5, // 5 tries
|
5, // 5 tries
|
||||||
1e3, // 1s delay between tries
|
1e3, // 1s delay between tries
|
||||||
fn,
|
fn,
|
||||||
() => agent.app.bsky.actor.getProfile({actor}),
|
() => getAgent().app.bsky.actor.getProfile({actor}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user