Skip to content

Commit a21e75d

Browse files
fix: guard for empty legend items
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent a8ec0a0 commit a21e75d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/components/Package/DownloadAnalytics.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,15 +1766,15 @@ const chartConfig = computed(() => {
17661766
</template>
17671767

17681768
<!-- Single series legend (no user interaction) -->
1769-
<template v-else>
1769+
<template v-else-if="legend.length > 0">
17701770
<div class="flex gap-1 place-items-center">
17711771
<div class="h-3 w-3">
17721772
<svg viewBox="0 0 2 2" class="w-full">
1773-
<rect x="0" y="0" width="2" height="2" rx="0.3" :fill="legend[0].color" />
1773+
<rect x="0" y="0" width="2" height="2" rx="0.3" :fill="legend[0]?.color" />
17741774
</svg>
17751775
</div>
17761776
<span>
1777-
{{ legend[0].name }}
1777+
{{ legend[0]?.name }}
17781778
</span>
17791779
</div>
17801780
</template>

0 commit comments

Comments
 (0)