From d696f219141c57460a609fb71f9a61ae92334170 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 25 Apr 2024 21:35:44 +0100 Subject: [PATCH] Drill getAgent instead --- src/state/queries/list.ts | 14 +++++++------- src/state/queries/profile.ts | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/state/queries/list.ts b/src/state/queries/list.ts index e41fedb9b4..1edf2606ce 100644 --- a/src/state/queries/list.ts +++ b/src/state/queries/list.ts @@ -87,7 +87,7 @@ export function useListCreateMutation() { // wait for the appview to update await whenAppViewReady( - getAgent(), + getAgent, res.uri, (v: AppBskyGraphGetList.Response) => { return typeof v?.data?.list.uri === 'string' @@ -156,7 +156,7 @@ export function useListMetadataMutation() { // wait for the appview to update await whenAppViewReady( - getAgent(), + getAgent, res.uri, (v: AppBskyGraphGetList.Response) => { const list = v.data.list @@ -230,7 +230,7 @@ export function useListDeleteMutation() { // wait for the appview to update await whenAppViewReady( - getAgent(), + getAgent, uri, (v: AppBskyGraphGetList.Response) => { return !v?.success @@ -258,7 +258,7 @@ export function useListMuteMutation() { } await whenAppViewReady( - getAgent(), + getAgent, uri, (v: AppBskyGraphGetList.Response) => { return Boolean(v?.data.list.viewer?.muted) === mute @@ -284,7 +284,7 @@ export function useListBlockMutation() { } await whenAppViewReady( - getAgent(), + getAgent, uri, (v: AppBskyGraphGetList.Response) => { return block @@ -302,7 +302,7 @@ export function useListBlockMutation() { } async function whenAppViewReady( - agent: BskyAgent, + getAgent: () => BskyAgent, uri: string, fn: (res: AppBskyGraphGetList.Response) => boolean, ) { @@ -311,7 +311,7 @@ async function whenAppViewReady( 1e3, // 1s delay between tries fn, () => - agent.app.bsky.graph.getList({ + getAgent().app.bsky.graph.getList({ list: uri, limit: 1, }), diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index ea39a82541..0d5d5e5bd6 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -155,7 +155,7 @@ export function useProfileUpdateMutation() { return existing }) await whenAppViewReady( - getAgent(), + getAgent, profile.did, checkCommitted || (res => { @@ -518,7 +518,7 @@ export function precacheThreadPostProfiles( } async function whenAppViewReady( - agent: BskyAgent, + getAgent: () => BskyAgent, actor: string, fn: (res: AppBskyActorGetProfile.Response) => boolean, ) { @@ -526,7 +526,7 @@ async function whenAppViewReady( 5, // 5 tries 1e3, // 1s delay between tries fn, - () => agent.app.bsky.actor.getProfile({actor}), + () => getAgent().app.bsky.actor.getProfile({actor}), ) }