APP-2977: Handle AppView polling errors (#11590)
This commit is contained in:
@@ -43,7 +43,7 @@ export async function bulkWriteFollows(
|
||||
writes: chunk,
|
||||
})
|
||||
}
|
||||
await whenFollowsIndexed(appviewClient, did, res => !!res.follows.length)
|
||||
await whenFollowsIndexed(appviewClient, did, res => !!res?.follows.length)
|
||||
|
||||
const followUris = new Map<string, string>()
|
||||
for (const r of followWrites) {
|
||||
@@ -58,7 +58,10 @@ export async function bulkWriteFollows(
|
||||
async function whenFollowsIndexed(
|
||||
appviewClient: Client,
|
||||
actor: string,
|
||||
fn: (res: app.bsky.graph.getFollows.$OutputBody) => boolean,
|
||||
fn: (
|
||||
res: app.bsky.graph.getFollows.$OutputBody | undefined,
|
||||
err: unknown,
|
||||
) => boolean,
|
||||
) {
|
||||
await until(
|
||||
5, // 5 tries
|
||||
|
||||
@@ -137,7 +137,11 @@ function GermSelfButton({did}: {did: string}) {
|
||||
rkey: 'self',
|
||||
})
|
||||
|
||||
await whenAppViewReady(appviewClient, did, res => !res.associated?.germ)
|
||||
await whenAppViewReady(
|
||||
appviewClient,
|
||||
did,
|
||||
res => !!res && !res.associated?.germ,
|
||||
)
|
||||
|
||||
return previousRecord
|
||||
},
|
||||
@@ -154,7 +158,7 @@ function GermSelfButton({did}: {did: string}) {
|
||||
await whenAppViewReady(
|
||||
appviewClient,
|
||||
did,
|
||||
res => !!res.associated?.germ,
|
||||
res => !!res?.associated?.germ,
|
||||
)
|
||||
await queryClient.refetchQueries({queryKey: RQKEY(did)})
|
||||
|
||||
@@ -326,7 +330,10 @@ function platform() {
|
||||
async function whenAppViewReady(
|
||||
appviewClient: Client,
|
||||
actor: string,
|
||||
fn: (res: app.bsky.actor.getProfile.$OutputBody) => boolean,
|
||||
fn: (
|
||||
res: app.bsky.actor.getProfile.$OutputBody | undefined,
|
||||
err: unknown,
|
||||
) => boolean,
|
||||
) {
|
||||
await until(
|
||||
5, // 5 tries
|
||||
|
||||
@@ -80,6 +80,7 @@ export function AutomationLabelSettingsScreen({}: Props) {
|
||||
return existing
|
||||
},
|
||||
checkCommitted: profile => {
|
||||
if (!profile) return false
|
||||
const exists = !!profile.labels?.some(l => l.val === 'bot')
|
||||
return exists === wasAdded
|
||||
},
|
||||
|
||||
@@ -70,6 +70,7 @@ export function PwiOptOut() {
|
||||
return existing
|
||||
},
|
||||
checkCommitted: profile => {
|
||||
if (!profile) return false
|
||||
const exists = !!profile.labels?.some(
|
||||
l => l.val === '!no-unauthenticated',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user