Skip to content

Commit 3ad742b

Browse files
committed
fix: add back in ttl and reverse order limiting to 1 record
1 parent b76ba2a commit 3ad742b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

app/composables/useBlogPostBlueskyLink.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Constellation } from '#shared/utils/constellation'
22
import { NPMX_SITE } from '#shared/utils/constants'
33

4+
const BLOG_BACKLINK_TTL_IN_SECONDS = 60 * 5
5+
46
export interface BlogPostBlueskyLink {
57
did: string
68
rkey: string
@@ -30,10 +32,14 @@ export function useBlogPostBlueskyLink(slug: MaybeRefOrGetter<string | null | un
3032
url,
3133
'app.bsky.feed.post',
3234
'embed.external.uri',
35+
1,
36+
undefined,
37+
true,
3338
[['did:plc:jbeaa5kdaladzwq3r7f5xgwe']],
39+
BLOG_BACKLINK_TTL_IN_SECONDS,
3440
)
3541

36-
const embedRecord = embedBacklinks.records[embedBacklinks.records.length - 1]
42+
const embedRecord = embedBacklinks.records[0]
3743
if (embedRecord) {
3844
return {
3945
did: embedRecord.did,
@@ -47,10 +53,14 @@ export function useBlogPostBlueskyLink(slug: MaybeRefOrGetter<string | null | un
4753
url,
4854
'app.bsky.feed.post',
4955
'facets[].features[app.bsky.richtext.facet#link].uri',
56+
1,
57+
undefined,
58+
true,
5059
[['did:plc:jbeaa5kdaladzwq3r7f5xgwe']],
60+
BLOG_BACKLINK_TTL_IN_SECONDS,
5161
)
5262

53-
const facetRecord = facetBacklinks.records[facetBacklinks.records.length - 1]
63+
const facetRecord = facetBacklinks.records[0]
5464
if (facetRecord) {
5565
return {
5666
did: facetRecord.did,

shared/utils/constellation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ export class Constellation {
5757
subject: string,
5858
collection: string,
5959
recordPath: string,
60-
filterByDids: [string][] = [],
6160
limit = 16,
6261
cursor?: string,
6362
reverse = false,
63+
filterByDids: [string][] = [],
6464
ttl: number | undefined = undefined,
6565
) {
6666
const source = encodeURIComponent(`${collection}:${recordPath}`)

0 commit comments

Comments
 (0)