Skip to content

Conversation

@OrbisK
Copy link
Contributor

@OrbisK OrbisK commented Feb 1, 2026

I think it is not an easy change to refactor all npm requests to useNpmRegistry (yet). As a first step, we could migrate all npm requests to $npmRegistry and $npmApi. Wdyt?

@vercel
Copy link

vercel bot commented Feb 1, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 1, 2026 2:28pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 1, 2026 2:28pm
npmx-lunaria Ignored Ignored Feb 1, 2026 2:28pm

Request Review

…ests

# Conflicts:
#	app/composables/useNpmRegistry.ts
#	app/utils/package-name.ts
@OrbisK OrbisK changed the title wip: proof of concept unifying all registry requests feat: unifying npm registry requests with caching Feb 1, 2026
@danielroe
Copy link
Member

this looks good!

would you investigate why the browser tests might be failing?

@OrbisK
Copy link
Contributor Author

OrbisK commented Feb 1, 2026

this looks good!

would you investigate why the browser tests might be failing?

Working on it. Maybe you know what the issue is. e.g. the org page is broken.

https://npmxdev-git-fork-orbisk-feat-concept-npm-requests-poetry.vercel.app/@nuxt

image

Here: https://github.com/npmx-dev/npmx.dev/pull/641/changes#diff-93fe589cec6bc2b865b353a91ba90b4407706ff4baf16189a4c2c538351aa26aR523

@OrbisK
Copy link
Contributor Author

OrbisK commented Feb 1, 2026

I think the problem is that cachedFetch from the plugin uses the server side fetch on the client 🤷🏽‍♂️

I think I have a fix.

@OrbisK
Copy link
Contributor Author

OrbisK commented Feb 1, 2026

I am super confused. Are $npmRegistry request meant to run client side? Because there are cors issues when requesting the orgs

@OrbisK
Copy link
Contributor Author

OrbisK commented Feb 1, 2026

Okay. The request returns the data and 200 but cors is still blocking it 🤔

@danielroe
Copy link
Member

danielroe commented Feb 1, 2026

$npmRegistry should be idempotent, yes. (it should be safe to call in either case)

if there's stale data (or missing data) from the server, then it will refetch on the client

@danielroe danielroe self-requested a review February 1, 2026 17:24
@OrbisK
Copy link
Contributor Author

OrbisK commented Feb 1, 2026

Progress: I have fixed it locally. But i am not sure how...

Comment on lines +33 to +34
const { $npmApi } = useNuxtApp()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danielroe this line seems to be the problem.

replacing it by a simple mock "fixes" the issue. Any ideas 😅

 const $npmApi = ()=>{
  return Promise.resolve({data: null,})
 }

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.

2 participants