Skip to content

Conversation

@MatteoGabriele
Copy link
Contributor

@MatteoGabriele MatteoGabriele commented Feb 2, 2026

This is a proposal to fix the query length issue.
NPM has a query minimum of 2 characters, so it won't return anything even if the package actually exists.

Screen.Recording.2026-02-02.at.11.55.26.mov

closes #722

@vercel
Copy link

vercel bot commented Feb 2, 2026

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

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

Request Review

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
lunaria/files/en-US.json Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

maybe instead just query to see if that specific package exists, instead of making a search?

(but still display it as though it were a search)

@Netail
Copy link

Netail commented Feb 2, 2026

maybe instead just query to see if that specific package exists, instead of making a search?

(but still display it as though it were a search)

Would love that too, a regular list entry with the "exact" label

@MatteoGabriele
Copy link
Contributor Author

MatteoGabriele commented Feb 2, 2026

@danielroe I made some changes. I decided to handle the exception in the search result call directly so that the UI wouldn't need any weird exception handling.
Let me know what you think. I'm not a backend developer per se, so I don't have much experience on that side.

Screen.Recording.2026-02-02.at.14.43.52.mov

@MatteoGabriele MatteoGabriele changed the title feat(search): show package link for invalid query length feat(search): fallback to exact package lookup for short queries Feb 2, 2026
Copy link
Contributor

@wojtekmaj wojtekmaj left a comment

Choose a reason for hiding this comment

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

LGTM and works

@MatteoGabriele MatteoGabriele changed the title feat(search): fallback to exact package lookup for short queries feat(ui): fallback to exact package lookup for short queries Feb 2, 2026
Copy link
Contributor

@garthdw garthdw left a comment

Choose a reason for hiding this comment

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

Could we avoid the api call entirely since it will always error?

@MatteoGabriele
Copy link
Contributor Author

Could we avoid the api call entirely since it will always error?

Good point! I'll make a change

@danielroe danielroe changed the title feat(ui): fallback to exact package lookup for short queries fix(ui): fallback to exact package lookup for short queries Feb 2, 2026
@danielroe danielroe enabled auto-merge February 2, 2026 16:52
@danielroe danielroe added this pull request to the merge queue Feb 2, 2026
Merged via the queue into npmx-dev:main with commit 24b7e7e Feb 2, 2026
13 of 14 checks passed
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.

Unable to search 1 character packages

6 participants