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 agent: BskyAgent
postUri: string postUri: string
}): Promise<AppBskyFeedThreadgate.Record | undefined> { }): Promise<AppBskyFeedThreadgate.Record | null> {
const urip = new AtUri(postUri) const urip = new AtUri(postUri)
if (!urip.host.startsWith('did:')) { if (!urip.host.startsWith('did:')) {
@@ -71,11 +71,11 @@ export async function getThreadgateRecord({
if (data.value && AppBskyFeedThreadgate.isRecord(data.value)) { if (data.value && AppBskyFeedThreadgate.isRecord(data.value)) {
return data.value return data.value
} else { } else {
return undefined return null
} }
} catch (e: any) { } catch (e: any) {
if (e.message.includes(`Could not locate record:`)) { if (e.message.includes(`Could not locate record:`)) {
return undefined return null
} else { } else {
throw new Error(`Failed to get threadgate record`, {cause: e}) throw new Error(`Failed to get threadgate record`, {cause: e})
} }
@@ -117,7 +117,7 @@ export async function upsertThreadgate(
postUri: string postUri: string
}, },
callback: ( callback: (
threadgate: AppBskyFeedThreadgate.Record | undefined, threadgate: AppBskyFeedThreadgate.Record | null,
) => Promise<AppBskyFeedThreadgate.Record | undefined>, ) => Promise<AppBskyFeedThreadgate.Record | undefined>,
) { ) {
const prev = await getThreadgateRecord({ const prev = await getThreadgateRecord({
+1 -1
View File
@@ -187,7 +187,7 @@ export function PostThread({
treeView, treeView,
threadModerationCache, threadModerationCache,
hiddenRepliesState !== HiddenRepliesState.Hide, hiddenRepliesState !== HiddenRepliesState.Hide,
threadgateRecord, threadgateRecord || undefined,
) )
}, [ }, [
thread, thread,