@@ -39,7 +39,7 @@ const props = withDefaults(
3939 * Used when `weeklyDownloads` is not provided.
4040 */
4141 packageNames? : string []
42- repoRef? : RepoRef | null
42+ repoRef? : RepoRef
4343 createdIso? : string | null
4444
4545 /** When true, shows facet selector (e.g. Downloads / Likes). */
@@ -337,7 +337,7 @@ const effectivePackageNames = computed<string[]>(() => {
337337 return single ? [single ] : []
338338})
339339
340- const repoRefsByPackage = shallowRef <Record <string , RepoRef | null >>({})
340+ const repoRefsByPackage = shallowRef <Record <string , RepoRef | undefined >>({})
341341const repoRefsRequestToken = shallowRef (0 )
342342
343343async function loadRepoRefsForPackages(packages : string []) {
@@ -354,21 +354,21 @@ async function loadRepoRefsForPackages(packages: string[]) {
354354 const encoded = encodePackageName (name )
355355 const meta = await $fetch <PackageMetaResponse >(` /api/registry/package-meta/${encoded } ` )
356356 const repoUrl = meta ?.links ?.repository
357- const ref = repoUrl ? parseRepoUrl (repoUrl ) : null
357+ const ref = repoUrl ? parseRepoUrl (repoUrl ) : undefined
358358 return { name , ref }
359359 }),
360360 )
361361
362362 if (currentToken !== repoRefsRequestToken .value ) return
363363
364- const next: Record <string , RepoRef | null > = {}
364+ const next: Record <string , RepoRef | undefined > = {}
365365 for (const [index, entry] of settled .entries ()) {
366366 const name = packages [index ]
367367 if (! name ) continue
368368 if (entry .status === ' fulfilled' ) {
369- next [name ] = entry .value .ref ?? null
369+ next [name ] = entry .value .ref ?? undefined
370370 } else {
371- next [name ] = null
371+ next [name ] = undefined
372372 }
373373 }
374374 repoRefsByPackage .value = next
@@ -637,7 +637,7 @@ const DEFAULT_METRIC_ID: MetricId = 'downloads'
637637
638638type MetricContext = {
639639 packageName: string
640- repoRef: RepoRef | null
640+ repoRef: RepoRef | undefined
641641}
642642
643643type MetricDef = {
@@ -856,7 +856,7 @@ async function loadMetric(metricId: MetricId) {
856856
857857 const settled = await Promise .allSettled (
858858 packageNames .map (async pkg => {
859- const repoRef = metricId === ' contributors' ? repoRefsByPackage .value [pkg ] : null
859+ const repoRef = metricId === ' contributors' ? repoRefsByPackage .value [pkg ] : undefined
860860 const result = await fetchFn ({ packageName: pkg , repoRef })
861861 return { pkg , result: (result ?? []) as EvolutionData }
862862 }),
@@ -898,7 +898,7 @@ async function loadMetric(metricId: MetricId) {
898898 }
899899 }
900900
901- const result = await fetchFn ({ packageName: pkg , repoRef: props .repoRef ?? null })
901+ const result = await fetchFn ({ packageName: pkg , repoRef: props .repoRef })
902902 if (currentToken !== state .requestToken ) return
903903
904904 state .evolution = (result ?? []) as EvolutionData
@@ -1498,7 +1498,7 @@ const chartConfig = computed(() => {
14981498 axis: {
14991499 yLabel: $t (' package.trends.y_axis_label' , {
15001500 granularity: getGranularityLabel (selectedGranularity .value ),
1501- facet: activeMetricDef .value .label ,
1501+ facet: activeMetricDef .value ? .label ,
15021502 }),
15031503 yLabelOffsetX: 12 ,
15041504 fontSize: isMobile .value ? 32 : 24 ,
@@ -1695,7 +1695,7 @@ watch(selectedMetric, value => {
16951695 </div >
16961696
16971697 <h2 id =" trends-chart-title" class =" sr-only" >
1698- {{ $t('package.trends.title') }} — {{ activeMetricDef.label }}
1698+ {{ $t('package.trends.title') }} — {{ activeMetricDef? .label }}
16991699 </h2 >
17001700
17011701 <!-- Chart panel (active metric) -->
0 commit comments