Skip to content

Commit 8507bf0

Browse files
committed
fix: small niggles
1 parent 2d56a50 commit 8507bf0

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

app/composables/useRepoMeta.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export function useRepoMeta(repositoryUrl: MaybeRefOrGetter<string | null | unde
146146
})
147147

148148
const { data, pending, error, refresh } = useLazyAsyncData<RepoMeta | null>(
149-
requestKey,
149+
() => requestKey.value,
150150
async () => {
151151
const ref = repoRef.value
152152
if (!ref) return null
@@ -155,13 +155,9 @@ export function useRepoMeta(repositoryUrl: MaybeRefOrGetter<string | null | unde
155155
{ default: () => null },
156156
)
157157

158-
watch(
159-
repoRef,
160-
ref => {
161-
if (ref) refresh()
162-
},
163-
{ immediate: true },
164-
)
158+
watch(repoRef, ref => {
159+
if (ref) refresh()
160+
})
165161

166162
const meta = computed<RepoMeta | null>(() => data.value ?? null)
167163

app/pages/[...package].vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ const repositoryUrl = computed(() => {
154154
return url
155155
})
156156
157-
const { stars, forks, forksLink } = useRepoMeta(repositoryUrl)
157+
const { meta: repoMeta, stars, forks, forksLink } = useRepoMeta(repositoryUrl)
158158
159159
const homepageUrl = computed(() => {
160160
return displayVersion.value?.homepage ?? null
@@ -485,7 +485,9 @@ defineOgImageComponent('Package', {
485485
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
486486
>
487487
<span class="i-carbon-logo-github w-4 h-4" aria-hidden="true" />
488-
<span v-if="stars"> {{ formatCompactNumber(stars, { decimals: 1 }) }} stars </span>
488+
<span v-if="repoMeta">
489+
{{ formatCompactNumber(stars, { decimals: 1 }) }} stars
490+
</span>
489491
<span v-else>repo</span>
490492
</a>
491493
</li>

0 commit comments

Comments
 (0)