fix(predict): hide empty related-tag sub-tabs via activeEventsCount cp-8.3.0#33399
fix(predict): hide empty related-tag sub-tabs via activeEventsCount cp-8.3.0#33399matallui wants to merge 3 commits into
Conversation
Empty dynamic sub-tabs (e.g. "Other") rendered zero markets because omit_empty=true only drops globally-empty tags. Skip related tags whose activeEventsCount is 0 in normalizeRelatedTagsToFilterOptions, before the limit accounting so empty tags don't consume a slot. Fail-open on a missing count.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
Skipping SonarCloud as job keeps failing due to outage |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
This is a low-risk, targeted change to the Polymarket utility layer. The functional impact is limited to the filter chip rendering in the Predictions feature. Tags selected:
No performance impact expected — this is a simple conditional check in a utility function that filters UI elements, not a performance-sensitive code path. Performance Test Selection: |
Description
Empty dynamic sub-tabs/chips (e.g. "Other") rendered under a feed's related-tags even though they resolve to zero markets. The Polymarket related-tags endpoint's
omit_empty=trueonly drops globally-empty tags, so a tag can still surface with no markets under the applied params.This fix skips related tags whose
activeEventsCountis0insidenormalizeRelatedTagsToFilterOptions— the single point every dynamic chip (crypto, politics, sports tabs, trending, popular-today) flows through. The skip happens before thelimitaccounting so empty tags don't consume a chip slot, and it fails open (a missing/undefined count keeps the chip, preserving prior best-effort behavior). No extra API calls are introduced.Changelog
CHANGELOG entry: Fixed empty prediction market sub-tabs (e.g. "Other") showing zero markets by hiding related-tag chips with no active events.
Related issues
Fixes: PRED-1085
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Localized Predict UI filter normalization with fail-open when counts are absent; no auth, payments, or API contract changes beyond using an existing response field.
Overview
Hides zero-market related-tag filter chips (e.g. "Other") in Predict Polymarket feeds by filtering in
normalizeRelatedTagsToFilterOptions, which is the shared path for dynamic sub-tabs on crypto, politics, sports, trending, and similar feeds.Tags with
activeEventsCount === 0are skipped before slug dedupe andlimitaccounting, so empty tags neither render nor steal a chip slot.activeEventsCountis documented onPolymarketRelatedTag; when the field is missing, tags are still included (fail-open). No new API calls.Unit tests cover zero-count filtering, fail-open behavior, and limit behavior with leading empty tags.
Reviewed by Cursor Bugbot for commit a87f621. Bugbot is set up for automated code reviews on this repo. Configure here.