Skip to content

fix: preserve npm download data for scoped packages (fixes #1640)#1727

Merged
Simek merged 1 commit intoreact-native-community:mainfrom
JairajJangle:fix/1640-download-count
Jun 22, 2025
Merged

fix: preserve npm download data for scoped packages (fixes #1640)#1727
Simek merged 1 commit intoreact-native-community:mainfrom
JairajJangle:fix/1640-download-count

Conversation

@JairajJangle
Copy link
Copy Markdown
Contributor

@JairajJangle JairajJangle commented Jun 21, 2025

📝 Why & how

Fixes #1640 - Download counts were not displaying for packages with "@" character (scoped packages) due to npm data being overwritten during bulk query merge. Scoped packages are processed individually but their npm data was being replaced with empty objects from the bulk results.

  • Preserve existing npm data when merging bulk query results
  • Ensures scoped packages retain their individually-fetched download stats
  • Regular packages continue to work as before

before_fix after_fix
Before: download count is missing After: download count is displayed

✅ Checklist

  • Documented in this PR how to use the feature or replicate the bug.
  • Documented in this PR how you fixed or created the feature.

…munity#1640)

Scoped packages (starting with @) were losing their download counts
because individual npm data was being overwritten during bulk merge.
Now preserves existing npm data while still filling regular packages.
@JairajJangle
Copy link
Copy Markdown
Contributor Author

JairajJangle commented Jun 21, 2025

@Simek Let me know if I need to commit the updated assets/data.json and update the PR or is it something that is auto-generated in some build pipeline workflow.

@JairajJangle JairajJangle changed the title fix: preserve npm download data for scoped packages (#1640) fix: preserve npm download data for scoped packages (fixes #1640) Jun 21, 2025
Copy link
Copy Markdown
Member

@Simek Simek left a comment

Choose a reason for hiding this comment

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

Hey @JairajJangle, nice catch, thanks for addressing this! 👍

In the near future we plan to switch the download counts data source, which should give us way more flexibility, and would ensure more stability, than the official API that npm offers. I also hope that the switch would also remove the need of backfilling the data from the stored copy from previous fetches.

Let me know if I need to commit the updated assets/data.json and update the PR or is it something that is auto-generated in some build pipeline workflow.

The data file is generated during each website deploy. The file committed to the repository is only for development/debug purposes, so there is no urgent need to update it.

@Simek Simek merged commit e0bf8f6 into react-native-community:main Jun 22, 2025
1 check passed
JairajJangle added a commit to JairajJangle/react-native-community-directory that referenced this pull request Jun 22, 2025
JairajJangle added a commit to JairajJangle/react-native-community-directory that referenced this pull request Jun 24, 2025
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.

Download count not displayed for packages with names starting with @

2 participants