Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThis pull request implements search result pagination improvements by introducing a configurable results limit per search provider. Changes include adding a Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
app/components/PaginationControls.vue (1)
5-5: Rename the threshold constant before the typo spreads further.
ALL_PAGES_VISIBLE_TRESHOLDis misspelt, which makes the intent look accidental and makes future searches/reuse harder. Please rename it toALL_PAGES_VISIBLE_THRESHOLDwhile it is still local to this component.As per coding guidelines,
**/*.{ts,tsx,vue}should "Use clear, descriptive variable and function names".Also applies to: 68-68, 104-104
app/composables/useSettings.ts (1)
5-5: Prefer the shared-types auto-import here.
app/composables/*already getsshared/types/*exports auto-imported, so this extra type import is unnecessary noise.Based on learnings, exports from
shared/types/*are auto-imported by Nuxt for composables and components, so explicit imports for those types are unnecessary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d48761f8-b319-4497-8e1e-c7c6b829a4d1
📒 Files selected for processing (13)
app/components/Package/Card.vueapp/components/PaginationControls.vueapp/composables/npm/search-utils.tsapp/composables/npm/useAlgoliaSearch.tsapp/composables/npm/useSearch.tsapp/composables/npm/useUserPackages.tsapp/composables/useGlobalSearch.tsapp/composables/useSettings.tsapp/pages/search.vuei18n/locales/en.jsoni18n/schema.jsonshared/types/npm-registry.tsshared/types/preferences.ts
💤 Files with no reviewable changes (1)
- app/components/Package/Card.vue
| // disable last page button to prevent TOO MANY REQUESTS error | ||
| function isPageButtonDisabled(page: number): boolean { | ||
| return totalPages.value > ALL_PAGES_VISIBLE_TRESHOLD && page > currentPage.value + 2 | ||
| } |
There was a problem hiding this comment.
Expose the new disabled state visually on numbered page buttons.
The guard works, but the disabled page button still looks like a normal clickable button. That makes the new last-page restriction feel broken rather than intentional.
🎯 Proposed fix
- class="min-w-[32px] h-8 px-2 font-mono text-sm rounded transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
+ class="min-w-[32px] h-8 px-2 font-mono text-sm rounded transition-colors duration-200 disabled:opacity-40 disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"Also applies to: 207-208
| totalUnlimited: response.nbHits ?? 0, | ||
| total: Math.min(SEARCH_ENGINE_HITS_LIMIT.algolia, response.nbHits ?? 0), |
There was a problem hiding this comment.
Keep the Algolia cap contract consistent across helpers.
search() now returns a capped total plus totalUnlimited, but searchByOwner() in this file still returns the raw serverTotal as total. For owners with more than 1,000 packages, that will show a larger count than the list can ever contain, with no way to reach the missing results.
Suggested follow-up
- const max = options.maxResults ?? 1000
+ const max = options.maxResults ?? SEARCH_ENGINE_HITS_LIMIT.algolia
…
return {
isStale: false,
objects: allHits.map(hitToSearchResult),
- total: serverTotal,
+ total: Math.min(max, serverTotal),
+ totalUnlimited: serverTotal,
time: new Date().toISOString(),
}
🔗 Linked issue
Resolves #1923, #1921
🧭 Context
Search results pagination worked with errors for outputs with many items. There are issues with results for 1001+ items.
After investigation I've found the following limits:
searchendpoint) is strictly limited to 1000 hits(see jsDelivr that uses Algolia has only 100 pages of 10 items while 180k results available). See in Algolia docs. This means that we should limit our output on Algolia engine to 1000 hits. Possible solutions: usebrowseendpoint (see docs), but it is not available in current Algolia index used by npmx📚 Description
The following fixes implemented: