Skip to content

Commit 1a61975

Browse files
committed
refactor: change network order and edge cases handling
1 parent 45c491a commit 1a61975

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/components/OgImage/ShareCard.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ const { repositoryUrl } = useRepositoryUrl(displayVersion)
3434
const { stars, forks, repoRef, refresh: refreshRepoMeta } = useRepoMeta(repositoryUrl)
3535
3636
try {
37-
await refreshPkg()
38-
await Promise.all([refreshRepoMeta(), refreshDownloads()])
37+
await Promise.all([refreshPkg(), refreshDownloads()])
38+
await refreshRepoMeta()
3939
} catch (err) {
4040
console.warn('[share-card] Failed to load data server-side:', err)
4141
}
4242
4343
const version = computed(() => resolvedVersion.value ?? pkg.value?.['dist-tags']?.latest ?? '')
4444
const isLatest = computed(() => pkg.value?.['dist-tags']?.latest === version.value)
45-
const description = computed(() => pkg.value?.description ?? '')
45+
const description = computed(() => pkg.value?.description || 'No description.')
4646
const license = computed(() => pkg.value?.license ?? '')
4747
const hasTypes = computed(() =>
4848
Boolean(displayVersion.value?.types || displayVersion.value?.typings),
@@ -115,7 +115,7 @@ const fontMono = "'Geist Mono'"
115115
class="text-[2.5rem] font-medium leading-none tracking-[-1.5px]"
116116
:style="{ color: theme.text, fontFamily: fontMono }"
117117
>
118-
{{ compactFormatter.format(weeklyDownloads) }}
118+
{{ weeklyDownloads > 0 ? compactFormatter.format(weeklyDownloads) : '-' }}
119119
</span>
120120
<span class="text-[1.375rem] font-light" :style="{ color: theme.textMuted }"
121121
>weekly</span
@@ -128,7 +128,7 @@ const fontMono = "'Geist Mono'"
128128
class="text-[1.375rem] font-light leading-[1.6] mb-5"
129129
:style="{ color: theme.textMuted, fontFamily: fontSans }"
130130
>
131-
{{ truncate(description || 'No description.', 440) }}
131+
{{ truncate(description, 440) }}
132132
</div>
133133

134134
<!-- Tags -->
@@ -251,7 +251,7 @@ const fontMono = "'Geist Mono'"
251251
</div>
252252

253253
<!-- Dependencies -->
254-
<div class="flex flex-row items-center gap-2">
254+
<div v-if="depsCount > 0" class="flex flex-row items-center gap-2">
255255
<svg
256256
width="20"
257257
height="20"

0 commit comments

Comments
 (0)