Skip to content

Commit 828fe54

Browse files
fix: prevent infinite recursive loading of package stats (#675)
Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent 1a5622a commit 828fe54

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { OKLCH_NEUTRAL_FALLBACK, lightenOklch } from '~/utils/colors'
55
66
const props = defineProps<{
77
packageName: string
8+
createdIso: string | null
89
}>()
910
1011
const chartModal = useModal('chart-modal')
@@ -16,9 +17,6 @@ function openChartModal() {
1617
nextTick(() => chartModal.open())
1718
}
1819
19-
const { data: packument } = usePackage(() => props.packageName)
20-
const createdIso = computed(() => packument.value?.time?.created ?? null)
21-
2220
const { fetchPackageDownloadEvolution } = useCharts()
2321
2422
const { accentColors, selectedAccentColor } = useAccentColor()
@@ -92,7 +90,7 @@ async function loadWeeklyDownloads() {
9290
try {
9391
const result = await fetchPackageDownloadEvolution(
9492
() => props.packageName,
95-
() => createdIso.value,
93+
() => props.createdIso,
9694
() => ({ granularity: 'week' as const, weeks: 52 }),
9795
)
9896
weeklyDownloads.value = (result as WeeklyDownloadPoint[]) ?? []

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ function handleClick(event: MouseEvent) {
10441044
</ClientOnly>
10451045

10461046
<!-- Download stats -->
1047-
<PackageWeeklyDownloadStats :packageName />
1047+
<PackageWeeklyDownloadStats :packageName :createdIso="pkg?.time?.created ?? null" />
10481048

10491049
<!-- Playground links -->
10501050
<PackagePlaygrounds

0 commit comments

Comments
 (0)