fix check

This commit is contained in:
Hailey
2024-06-19 17:03:08 -07:00
parent dca966da52
commit a78f8ff168
+6 -8
View File
@@ -2,6 +2,7 @@ import {
AppBskyActorDefs, AppBskyActorDefs,
AppBskyFeedDefs, AppBskyFeedDefs,
AppBskyGraphDefs, AppBskyGraphDefs,
AppBskyGraphGetStarterPack,
AppBskyGraphStarterpack, AppBskyGraphStarterpack,
AtUri, AtUri,
BskyAgent, BskyAgent,
@@ -220,7 +221,7 @@ export function useEditStarterPackMutation({
onSuccess: async (_, {currentStarterPack}) => { onSuccess: async (_, {currentStarterPack}) => {
const parsed = parseStarterPackUri(currentStarterPack.uri) const parsed = parseStarterPackUri(currentStarterPack.uri)
await whenAppViewReady(agent, currentStarterPack.uri, v => { await whenAppViewReady(agent, currentStarterPack.uri, v => {
return currentStarterPack.cid !== v?.cid return currentStarterPack.cid !== v?.data.starterPack.cid
}) })
await invalidateActorStarterPacksQuery({ await invalidateActorStarterPacksQuery({
queryClient, queryClient,
@@ -248,15 +249,12 @@ export function useEditStarterPackMutation({
async function whenAppViewReady( async function whenAppViewReady(
agent: BskyAgent, agent: BskyAgent,
uri: string, uri: string,
fn: (res?: AppBskyGraphDefs.StarterPackView) => boolean, fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
) { ) {
await until( await until(
10, // 5 tries 5, // 5 tries
1e5, // 1s delay between tries 1e3, // 1s delay between tries
fn, fn,
() => () => agent.app.bsky.graph.getStarterPack({starterPack: uri}),
agent.app.bsky.graph.getStarterPack({
starterPack: uri,
}),
) )
} }