Fix RQ error, return null for query

This commit is contained in:
Eric Bailey
2024-08-05 19:45:34 -05:00
parent 15862a6f7f
commit 4b5952c08c
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -49,7 +49,7 @@ export async function getThreadgateRecord({
}: {
agent: BskyAgent
postUri: string
}): Promise<AppBskyFeedThreadgate.Record | undefined> {
}): Promise<AppBskyFeedThreadgate.Record | null> {
const urip = new AtUri(postUri)
if (!urip.host.startsWith('did:')) {
@@ -71,11 +71,11 @@ export async function getThreadgateRecord({
if (data.value && AppBskyFeedThreadgate.isRecord(data.value)) {
return data.value
} else {
return undefined
return null
}
} catch (e: any) {
if (e.message.includes(`Could not locate record:`)) {
return undefined
return null
} else {
throw new Error(`Failed to get threadgate record`, {cause: e})
}
@@ -117,7 +117,7 @@ export async function upsertThreadgate(
postUri: string
},
callback: (
threadgate: AppBskyFeedThreadgate.Record | undefined,
threadgate: AppBskyFeedThreadgate.Record | null,
) => Promise<AppBskyFeedThreadgate.Record | undefined>,
) {
const prev = await getThreadgateRecord({
+1 -1
View File
@@ -187,7 +187,7 @@ export function PostThread({
treeView,
threadModerationCache,
hiddenRepliesState !== HiddenRepliesState.Hide,
threadgateRecord,
threadgateRecord || undefined,
)
}, [
thread,