diff --git a/src/lib/strings/starter-pack.ts b/src/lib/strings/starter-pack.ts
index 3794651836..489d0b9231 100644
--- a/src/lib/strings/starter-pack.ts
+++ b/src/lib/strings/starter-pack.ts
@@ -89,3 +89,13 @@ export function getStarterPackOgCard(
return `https://ogcard.cdn.bsky.app/start/${didOrStarterPack.creator.did}/${rkey}`
}
}
+
+export function createStarterPackUri({
+ did,
+ rkey,
+}: {
+ did: string
+ rkey: string
+}): string | null {
+ return new AtUri(`at://${did}/app.bsky.graph.starterpack/${rkey}`).toString()
+}
diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx
index 26879aab32..8d4c8402da 100644
--- a/src/screens/StarterPack/StarterPackScreen.tsx
+++ b/src/screens/StarterPack/StarterPackScreen.tsx
@@ -368,10 +368,14 @@ function OverflowMenu({
const isOwn = starterPack.creator.did === currentAccount?.did
const onDeleteStarterPack = async () => {
+ if (!starterPack.list) {
+ logger.error(`Unable to delete starterpack because list is missing`)
+ return
+ }
+
deleteStarterPack({
rkey: routeParams.rkey,
- // TODO need to fix types
- listUri: starterPack.list!.uri,
+ listUri: starterPack.list.uri,
})
logEvent('starterPack:delete', {})
}
@@ -449,14 +453,16 @@ function OverflowMenu({
-
+ {starterPack.list && (
+
+ )}
diff --git a/src/state/queries/starter-packs.ts b/src/state/queries/starter-packs.ts
index 128129329d..ea8224e787 100644
--- a/src/state/queries/starter-packs.ts
+++ b/src/state/queries/starter-packs.ts
@@ -18,6 +18,7 @@ import {
import {until} from 'lib/async/until'
import {createStarterPackList} from 'lib/generate-starterpack'
import {
+ createStarterPackUri,
httpStarterPackUriToAtUri,
parseStarterPackUri,
} from 'lib/strings/starter-pack'
@@ -261,7 +262,6 @@ export function useDeleteStarterPackMutation({
throw new Error(`Requires logged in user`)
}
- // TODO parallel?
await agent.app.bsky.graph.list.delete({
repo: agent.session.did,
rkey: new AtUri(listUri).rkey,
@@ -272,6 +272,17 @@ export function useDeleteStarterPackMutation({
})
},
onSuccess: async (_, {listUri, rkey}) => {
+ const uri = createStarterPackUri({
+ did: agent.session!.did,
+ rkey,
+ })
+
+ if (uri) {
+ await whenAppViewReady(agent, uri, v => {
+ return Boolean(v?.data?.starterPack) === false
+ })
+ }
+
await invalidateListMembersQuery({queryClient, uri: listUri})
await invalidateActorStarterPacksQuery({
queryClient,