Skip to content

fix: org page fetching metadata at once#1953

Draft
Adebesin-Cell wants to merge 1 commit intonpmx-dev:mainfrom
Adebesin-Cell:fix/org
Draft

fix: org page fetching metadata at once#1953
Adebesin-Cell wants to merge 1 commit intonpmx-dev:mainfrom
Adebesin-Cell:fix/org

Conversation

@Adebesin-Cell
Copy link
Contributor

Problem

The org page was fetching metadata for all packages in an organization at once. For large orgs like @types with 8000+ packages, this triggered either:

  • a single massive Algolia request (likely exceeding API limits), or
  • thousands of individual package-metadata requests.

This caused the page to hang for several minutes.

Fix

Metadata fetching is now capped at 1000 packages (MAX_ORG_PACKAGES). A response type with a totalPackages field was added so the UI can still display the actual total number of packages even when the results are capped.

Requests to Algolia are also batched in chunks of 1000 (the getObjects API limit), preventing oversized single requests from failing.

The UI now uses totalPackages for the header count and OG image, so users still see the real organization size (e.g., “8000 packages”) even though only the first 1000 packages have metadata loaded.

Impact

  • @types org: reduced from ~8000 individual metadata fetches to 1 batched Algolia request (1000 packages)
  • Normal orgs (<1000 packages): no behavior change
  • The header still shows the correct total package count.

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 5, 2026 10:56pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 5, 2026 10:56pm
npmx-lunaria Ignored Ignored Mar 5, 2026 10:56pm

Request Review

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/composables/npm/useAlgoliaSearch.ts 0.00% 7 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant