fix(ui): allow custom badge values in docs generator#2335
fix(ui): allow custom badge values in docs generator#2335graphieros merged 2 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThe pull request extends the ISR caching configuration for the badge API endpoint to include the 'value' query parameter in its variability list. The 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)
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 |
trueberryless
left a comment
There was a problem hiding this comment.
LGTM 🎉
Thanks for the investigation!
I completely missed that we have a whitelist for parameters. Well TIL! 🫡
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/e2e/badge.spec.ts (1)
175-184: Strengthen this test to actually cover URL-encoded values.
custom-value-123is not transformed byencodeURIComponent, so this currently validates plain value handling more than encoded value handling.Proposed tweak
- test('custom value parameter is applied to SVG', async ({ page, baseURL }) => { - const customValue = 'custom-value-123' + test('custom value parameter is applied to SVG', async ({ page, baseURL }) => { + const customValue = 'custom value 123' const url = toLocalUrl( baseURL, `/api/registry/badge/version/nuxt?value=${encodeURIComponent(customValue)}`, ) - const { body } = await fetchBadge(page, url) + const { response, body } = await fetchBadge(page, url) + expect(response.status()).toBe(200) expect(body).toContain(customValue) })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bf8379a0-9d7b-4f32-b3b3-3debbb6189ce
📒 Files selected for processing (2)
nuxt.config.tstest/e2e/badge.spec.ts
🔗 Linked issue
Closes #2326
🧭 Context
Custom badge value looked broken in docs because the
valuequery param was not preserved through badge ISR route rules.📚 Description
valueto badge routeallowQueryinnuxt.config.ts?value=is reflected in badge SVG output