Skip to content

fix: source profile data from npm#2505

Draft
jonchurch wants to merge 3 commits intonpmx-dev:mainfrom
jonchurch:fix/user-profile-packages-data-source
Draft

fix: source profile data from npm#2505
jonchurch wants to merge 3 commits intonpmx-dev:mainfrom
jonchurch:fix/user-profile-packages-data-source

Conversation

@jonchurch
Copy link
Copy Markdown
Contributor

@jonchurch jonchurch commented Apr 13, 2026

fixes #2504

This PR reuses the org code to power the useUserPackages.ts hook.

Why? well the endpoint to get packages for orgs also works for users, by design. So we can reuse the API w/o any loss of accuracy.

It's a dirty lil hack rn, just reuse that same hook. I spent enough time root causing this bug, so this is the short term fix that I prefer and prefer to have reviewed. Seeing the red checks made me come back and try to do this slightly cleaner lol. Now im jsut duplicatng the logic of the org hook whereas before I was using the org hook itself. It's messy.

There is an existing bug btw on the Org pages, which is present in this PR as well. The org logic is limited to fetching 1k packages at once from npm, but there is no limit or pagination currently. See https://www.npmx.dev/~sindresorhus , on an empty cache that makes requests for every single one of his 1690 packages to fetch metadata as a fallback after the 400. Issue for that is #2507

Before 📸

Screenshot 2026-04-13 at 5 40 06 PM

After 📸

Screenshot 2026-04-13 at 5 39 58 PM

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

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

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

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 03752a39-a699-499a-91c4-df22f7f65137

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The user profile page's package listing logic is refactored to use the useOrgPackages() composable instead of useUserPackages(), replacing pagination/infinite-scroll controls with simpler data consumption. URL updates via debounced filtering replace previous prefetch logic, and pagination-related props and event handlers are removed from the PackageList component integration.

Changes

Cohort / File(s) Summary
User Profile Packages
app/pages/~[username]/index.vue
Switched from useUserPackages() to useOrgPackages() composable for retrieving user packages; removed pagination controls (isLoadingMore, hasMore, loadMore, loadAll, pageSize); replaced URL-driven prefetch logic with unconditional debounced URL updates; simplified PackageList integration by removing pagination-related props (:has-more, :is-loading, :page-size) and event handlers (@load-more).
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title references sourcing profile data from npm, which directly addresses the main objective of fixing user profile pages to show packages from npm maintainers rather than repository owners.
Linked Issues check ✅ Passed The code changes implement Option 1 from issue #2504: reusing org-page logic that queries npm API first before enriching with Algolia, replacing the flawed Algolia-only user-package composable with the npm-centric approach.
Out of Scope Changes check ✅ Passed All changes are scoped to switching the data source from useUserPackages (Algolia-based) to useOrgPackages (npm API-based) and removing pagination logic, which directly addresses the linked issue requirements.
Description check ✅ Passed The description clearly relates to the changeset, explaining that the PR reuses org code logic for the useUserPackages hook to fix incorrect package listings on user profile pages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/pages/`~[username]/index.vue:
- Around line 40-41: The user page is reusing useOrgPackages(username) which
returns organisation-specific 404 semantics causing "~missing-user" to show org
wording; wrap or parameterise useOrgPackages so the user route normalises
not-found errors to user semantics: update the call in ~[username]/index.vue to
use a thin wrapper (e.g., fetchUserPackages or pass an option like {
normalizeNotFound: true }) that catches error responses from useOrgPackages and
maps organisation 404s to a standard user 404 (or rethrows a normalized
NotFoundError), and ensure the "~missing-user" path logic at the user page
consumes that normalized error instead of org-specific messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6edebd49-8496-4db6-86a3-bbceb4a7d03d

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1e259 and ccab82e.

📒 Files selected for processing (1)
  • app/pages/~[username]/index.vue

Comment on lines +40 to +41
// Fetch packages — reuses the org endpoint which accepts usernames too
const { data: results, status, error } = useOrgPackages(username)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Normalise the not-found semantics before reusing useOrgPackages() here.

useOrgPackages() still throws organisation-specific 404s, so ~missing-user can now surface organisation wording on this user page at Line 175, and the server path can short-circuit into the global 404 flow. Please wrap or parameterise the shared composable so user profiles keep user-specific error handling instead of inheriting the org-page behaviour. As per coding guidelines: Use error handling patterns consistently.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/pages/`~[username]/index.vue around lines 40 - 41, The user page is
reusing useOrgPackages(username) which returns organisation-specific 404
semantics causing "~missing-user" to show org wording; wrap or parameterise
useOrgPackages so the user route normalises not-found errors to user semantics:
update the call in ~[username]/index.vue to use a thin wrapper (e.g.,
fetchUserPackages or pass an option like { normalizeNotFound: true }) that
catches error responses from useOrgPackages and maps organisation 404s to a
standard user 404 (or rethrows a normalized NotFoundError), and ensure the
"~missing-user" path logic at the user page consumes that normalized error
instead of org-specific messages.

jonchurch

This comment was marked as outdated.

fix: use dedicated useUserPackages composable with correct 404 handling
@jonchurch jonchurch force-pushed the fix/user-profile-packages-data-source branch from 609b48f to 5069b13 Compare April 13, 2026 22:09
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.

~user profile pages show packages by repo owner, not npm maintainer

1 participant