Repository navigation
fix bookmarks limit, owner filter and data cleanups - #3051
jkasprzyk17 wants to merge 2 commits into
Conversation
- detect bookmarks cookie writes dropped by the browser size limit and show it in the tooltip - match the whole owner name (case-insensitive) in the owner filter, fix "More packages" counter - keep case-sensitive versions in the code browser and unpkg proxy - don't show "no results" in QuickSearch while results are loading - use a fixed 30-day downloads period for npm-stat, matching npm `last-month` - count topics across all libraries when refreshing a single package - remove the unused cron refresh API route
Simek
left a comment
There was a problem hiding this comment.
Hey @jkasprzyk17, thanks for the PR! 👍
However, there are a lot of unrelated and questionable changes in the changeset, and few of them would require manual testing. I would appreciate if you can split the changes to smaller PR - one per touched topic to make it easier to review and test stuff.
| More packages from {startCase(owner)} | ||
| {!isLoading && data?.total && data.total > 0 ? ( | ||
| <EntityCounter count={data.total > LIMIT ? data.total : data.total - 1} /> | ||
| <EntityCounter count={data.total - 1} /> |
There was a problem hiding this comment.
We don't want to show all related pages on the other package details section, "See all packages" link is for that, and redirect user to the packages list.
| </View> | ||
| )} | ||
| {!hasResults && ( | ||
| {!hasResults && !isLoading && data && ( |
There was a problem hiding this comment.
This seems like unrelated change, also hasResults should be sufficient, when loading data the total would be undefined so hasResults would have correct value.
| @@ -1,77 +0,0 @@ | |||
| import { NextResponse } from 'next/server'; | |||
| // Versions are case-sensitive, e.g. `1.1.2-TEST.1`, so the param can't be lowercased | ||
| const selectedVersionParam = parseQueryParams(router.query).selectedVersion ?? 'latest'; |
There was a problem hiding this comment.
I think it's fine to lowercase versions.
|
|
||
| const ATTEMPTS_LIMIT = 2; | ||
| const REQUEST_TIMEOUT = 5000; | ||
| const DAY_IN_MS = 864e5; |
There was a problem hiding this comment.
|
Thanks for the review! I've split this PR into one PR per topic, with the review comments addressed (unrelated changes dropped,
Closing this one in favor of those. |
📝 Why & how
A batch of smaller fixes found while auditing the site. It's independent from #3049 and #3050 and merges cleanly with both.
UI
bookmarksfilter on the server didn't include it.toggleBookmarknow reads the cookie back after writing (saveBookmarksToCookie). If the browser dropped the write, the state stays unchanged, and the button tooltip says the bookmarks limit was reached. The cookie format and the server-sidebookmarksfilter are unchanged; raising the limit itself would need a storage decision (e.g. compact format or multiple cookies).ownerfilter matched other organizations.githubUrl.startsWith('https://github.com/' + owner)without a trailing slash, soexpoalso matchedexponotify,callstackmatchedcallstackincubator,software-mansionmatchedsoftware-mansion-labs, andfacebookmatchedfacebookarchive. It was also case-sensitive (microsoftvsMicrosoftin entry URLs).github.fullName). The package page derives the owner fromgithub.fullName, so the current package is always in the results.Data scripts
setMonth(-1)made the period 28–31 days long depending on the date (e.g. on March 30 it started on March 2), so monthly downloads and every Trending Score shifted by up to ~10% between days. The request now uses 30 full days ending yesterday (UTC, usingTimeRange.MONTHandTimeRange.DAY), the same period as the npm downloads APIlast-month. All scores shift slightly once, because the period was usually 31 days before. The4.25weeks divisor is left as is.bun data:update <package>overwrotetopicswith the topics of that single package. Topics are now counted across all libraries in that mode.✅ Checklist
How to verify
bun testcoverssaveBookmarksToCookiewith a cookie jar that drops cookies over 4096 bytes: a successful save, and a failed save that keeps the previous bookmarks.assets/data.json:expo107 → 106,callstack26 → 15,software-mansion26 → 12,facebook6 → 5,microsoft11 → 13,Microsoft2 → 13.fetchNpmStatDataBulk(['react-native-reanimated', '@shopify/flash-list'])returns the samedownloadsandweekDownloadsas the npm APIlast-monthandlast-week(2026-10-27..2026-11-25).bun lint,tscandbun testpass. The topics change is verified by reading only: a full data run needs a GitHub token.