feat: show badge on top liked packages, link to leaderboard#2459
feat: show badge on top liked packages, link to leaderboard#2459
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! |
bbf8518 to
2163460
Compare
Show a small rank badge next to the likes counter/button when a package is in the top 10 most-liked packages, and link that badge to a new in-app likes leaderboard page. For now at least, this is the only way to reach the leaderboard page. Both are powered by server-side fetching of the likes leaderboard API (https://tangled.org/baileytownsend.dev/npmx-likes-leaderboard), maintained by Bailey. Fetches degrade gracefully: no badge is shown on the package page, and the leaderboard page shows a message indicating that the data is unavailable. Successful fetches are cached for 1 hour, and are only revalidated in the background, following a stale-while-revalidate pattern (this is existing behaviour from `server/plugins/fetch-cache`). The leaderboard page is itself cached with ISR, with a revalidation time of 15 minutes.
This defers this very optional fetch to later and avoids caching degraded/failed responses.
b4b05d2 to
3ac3b69
Compare
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
🔗 Linked issue
N/A 😶
🧭 Context
Social likes are fun. Having users engage with the community, discover packages, and share socially about like ranks is fun.
📚 Description
Show a small rank badge next to the likes counter/button when a package is in the top 10 most-liked packages, and link that badge to a new in-app likes leaderboard page. For now at least, this is the only way to reach the leaderboard page.
npmx.top.liked.poc.demo.mp4
Both are powered by server-side fetching of the likes leaderboard API (https://tangled.org/baileytownsend.dev/npmx-likes-leaderboard), maintained by Bailey (@fatfingers23), who has agreed to treat this as a production service.
API fetches degrade gracefully: on failure, no badge is shown on the package page, and the leaderboard page shows a message indicating that the data is unavailable.
Successful fetches are cached for 1 hour, and are only revalidated in the background, following a
stale-while-revalidate-style pattern (this is existing behaviour fromserver/plugins/fetch-cache).The leaderboard page is itself cached with ISR, with a revalidation time of 15 minutes.