[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: prevent infinite recursive loading of package stats (#675)

Co-authored-by: Daniel Roe <daniel@roe.dev>

authored by

SHAMIL
Daniel Roe
and committed by
GitHub
828fe546 1a5622a6

+3 -5
+2 -4
app/components/Package/WeeklyDownloadStats.vue
··· 5 5 6 6 const props = defineProps<{ 7 7 packageName: string 8 + createdIso: string | null 8 9 }>() 9 10 10 11 const chartModal = useModal('chart-modal') ··· 15 16 // ensure the component renders before opening the dialog 16 17 nextTick(() => chartModal.open()) 17 18 } 18 - 19 - const { data: packument } = usePackage(() => props.packageName) 20 - const createdIso = computed(() => packument.value?.time?.created ?? null) 21 19 22 20 const { fetchPackageDownloadEvolution } = useCharts() 23 21 ··· 92 90 try { 93 91 const result = await fetchPackageDownloadEvolution( 94 92 () => props.packageName, 95 - () => createdIso.value, 93 + () => props.createdIso, 96 94 () => ({ granularity: 'week' as const, weeks: 52 }), 97 95 ) 98 96 weeklyDownloads.value = (result as WeeklyDownloadPoint[]) ?? []
+1 -1
app/pages/[...package].vue
··· 1044 1044 </ClientOnly> 1045 1045 1046 1046 <!-- Download stats --> 1047 - <PackageWeeklyDownloadStats :packageName /> 1047 + <PackageWeeklyDownloadStats :packageName :createdIso="pkg?.time?.created ?? null" /> 1048 1048 1049 1049 <!-- Playground links --> 1050 1050 <PackagePlaygrounds