Skip to content

Commit aa5f370

Browse files
committed
fix: apply coderabbit suggestion
1 parent a4dfa60 commit aa5f370

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

app/utils/charts.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,15 @@ export function createAltTextForVersionsBarChart({
543543
}: AltCopyArgs<VersionsBarDataset>) {
544544
if (!dataset) return ''
545545

546-
const versions = dataset.bars[0]?.series.map((value, i) => ({
547-
name: config.datapointLabels[i],
546+
const series = dataset.bars[0]?.series
547+
const versions = series?.map((value, i) => ({
548+
name: config.datapointLabels[i] ?? '-',
549+
rawDownloads: value ?? 0,
548550
downloads: config.numberFormatter(value),
549551
}))
550552

551553
const versionWithMaxDownloads = versions?.reduce((max, current) => {
552-
return current.downloads > max.downloads ? current : max
554+
return current.rawDownloads > max.rawDownloads ? current : max
553555
})
554556

555557
const per_version_analysis = versions

0 commit comments

Comments
 (0)