Skip to content

Commit 6c10982

Browse files
committed
chore: small tweaks
1 parent 2eb3f54 commit 6c10982

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

app/composables/npm/useOrgPackages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { mapWithConcurrency } from '#shared/utils/async'
77
*
88
* 1. Gets the authoritative package list from the npm registry (single request)
99
* 2. Fetches metadata from Algolia by exact name (single request)
10-
* 3. Falls back to individual packument fetches when Algolia is unavailable
10+
* 3. Falls back to lightweight server-side package-meta lookups
1111
*/
1212
export function useOrgPackages(orgName: MaybeRefOrGetter<string>) {
1313
const { searchProvider } = useSearchProvider()

app/composables/npm/useOutdatedDependencies.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ export function useOutdatedDependencies(
114114
watch(
115115
() => toValue(dependencies),
116116
deps => {
117-
fetchOutdatedInfo(deps)
117+
fetchOutdatedInfo(deps).catch(() => {
118+
// Network failure or fast-npm-meta outage — leave stale results in place
119+
})
118120
},
119121
{ immediate: true },
120122
)

server/api/registry/package-meta/[...pkg].get.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ export default defineCachedEventHandler(
2424
throw createError({ statusCode: 404, message: 'Package name is required' })
2525
}
2626

27-
const packageName = decodeURIComponent(pkgParam)
28-
const encodedName = encodePackageName(packageName)
27+
const encodedName = encodePackageName(pkgParam)
2928

3029
try {
3130
const [packument, downloads] = await Promise.all([
32-
fetchNpmPackage(packageName),
31+
fetchNpmPackage(pkgParam),
3332
$fetch<NpmDownloadCount>(`${NPM_API}/downloads/point/last-week/${encodedName}`).catch(
3433
() => null,
3534
),

0 commit comments

Comments
 (0)