Skip to content

fix bookmarks limit, owner filter and data cleanups - #3051

Closed
jkasprzyk17 wants to merge 2 commits into
react-native-community:mainfrom
jkasprzyk17:fix/ui-and-data-cleanups
Closed

jkasprzyk17 wants to merge 2 commits into
react-native-community:mainfrom
jkasprzyk17:fix/ui-and-data-cleanups

Conversation

@jkasprzyk17

@jkasprzyk17 jkasprzyk17 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📝 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

  • Bookmarks silently stopped saving at around 120 entries. The bookmarks are stored as one URL-encoded JSON cookie, and browsers ignore cookies over ~4 KB without any error. The UI kept showing the new bookmark until reload, and the bookmarks filter on the server didn't include it. toggleBookmark now 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-side bookmarks filter are unchanged; raising the limit itself would need a storage decision (e.g. compact format or multiple cookies).
  • owner filter matched other organizations.
    • The filter used githubUrl.startsWith('https://github.com/' + owner) without a trailing slash, so expo also matched exponotify, callstack matched callstackincubator, software-mansion matched software-mansion-labs, and facebook matched facebookarchive. It was also case-sensitive (microsoft vs Microsoft in entry URLs).
    • The filter now matches the whole owner name, case-insensitively, against the entry URL owner and the current owner reported by GitHub (github.fullName). The package page derives the owner from github.fullName, so the current package is always in the results.

Data scripts

  • Fixed downloads period for npm-stat. 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, using TimeRange.MONTH and TimeRange.DAY), the same period as the npm downloads API last-month. All scores shift slightly once, because the period was usually 31 days before. The 4.25 weeks divisor is left as is.
  • bun data:update <package> overwrote topics with the topics of that single package. Topics are now counted across all libraries in that mode.

✅ Checklist

  • Documented how you found or replicated the issue.
  • Explained how you fixed the issue or built the feature.
  • Described how to use or verify the change.

How to verify

  • bun test covers saveBookmarksToCookie with a cookie jar that drops cookies over 4096 bytes: a successful save, and a failed save that keeps the previous bookmarks.
  • Owner filter on the current assets/data.json: expo 107 → 106, callstack 26 → 15, software-mansion 26 → 12, facebook 6 → 5, microsoft 11 → 13, Microsoft 2 → 13.
  • fetchNpmStatDataBulk(['react-native-reanimated', '@shopify/flash-list']) returns the same downloads and weekDownloads as the npm API last-month and last-week (2026-10-27..2026-11-25).
  • bun lint, tsc and bun test pass. The topics change is verified by reading only: a full data run needs a GitHub token.

- 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 Simek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread components/QuickSearch.tsx Outdated
</View>
)}
{!hasResults && (
{!hasResults && !isLoading && data && (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this got randomly removed?

Comment thread scenes/PackageCodeScene.tsx Outdated
Comment on lines +37 to +38
// 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';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's fine to lowercase versions.

Comment thread scripts/fetch-npm-stat-data.ts Outdated

const ATTEMPTS_LIMIT = 2;
const REQUEST_TIMEOUT = 5000;
const DAY_IN_MS = 864e5;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@jkasprzyk17

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've split this PR into one PR per topic, with the review comments addressed (unrelated changes dropped, TimeRange used for the npm-stat period):

Closing this one in favor of those.

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