Skip to content

fix(predict): hide empty related-tag sub-tabs via activeEventsCount cp-8.3.0#33399

Open
matallui wants to merge 3 commits into
mainfrom
predict/PRED-1085
Open

fix(predict): hide empty related-tag sub-tabs via activeEventsCount cp-8.3.0#33399
matallui wants to merge 3 commits into
mainfrom
predict/PRED-1085

Conversation

@matallui

@matallui matallui commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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=true only drops globally-empty tags, so a tag can still surface with no markets under the applied params.

This fix skips related tags whose activeEventsCount is 0 inside normalizeRelatedTagsToFilterOptions — the single point every dynamic chip (crypto, politics, sports tabs, trending, popular-today) flows through. The skip happens before the limit accounting 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

Feature: Hide empty related-tag sub-tabs

  Scenario: user opens a feed with a globally-non-empty but locally-empty related tag
    Given a Predict feed whose related-tags API returns a tag with activeEventsCount of 0
    When the user views the feed's filter chips
    Then the empty chip (e.g. "Other") is not rendered
    And chips with active events still render up to the configured limit

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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 === 0 are skipped before slug dedupe and limit accounting, so empty tags neither render nor steal a chip slot. activeEventsCount is documented on PolymarketRelatedTag; 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.

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.
@github-actions

Copy link
Copy Markdown
Contributor

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.

@metamask-ci metamask-ci Bot added the team-predict Predict team label Jul 16, 2026
@metamask-ci

metamask-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Screenshots/Recordings section is empty. Add an image/video for user-facing changes, logs/console output for non-user-facing changes, or write N/A if no evidence is applicable.
  • Pre-merge author checklist has only 5 of the required 8 items. Every checklist row must be present and consciously checked — do not delete rows.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@matallui matallui marked this pull request as ready for review July 16, 2026 07:51
@matallui matallui requested a review from a team as a code owner July 16, 2026 07:51
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jul 16, 2026
@matallui matallui changed the title fix(predict): hide empty related-tag sub-tabs via activeEventsCount fix(predict): hide empty related-tag sub-tabs via activeEventsCount cp-8.3.0 Jul 16, 2026
@matallui matallui added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Jul 16, 2026
@matallui

Copy link
Copy Markdown
Contributor Author

Skipping SonarCloud as job keeps failing due to outage

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR modifies two files in app/components/UI/Predict/providers/polymarket/:

  1. utils.ts: Adds an optional activeEventsCount field to PolymarketRelatedTag interface and adds a guard in normalizeRelatedTagsToFilterOptions to skip tags with activeEventsCount === 0, preventing empty filter chips (e.g., "Other") from rendering in the Predictions UI.
  2. utils.test.ts: Adds unit tests for the new filtering behavior.

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:

  • SmokePredictions: Directly impacted — the changed utility function is used in the Polymarket predictions integration for filter options normalization.
  • SmokeWalletPlatform: Required per SmokePredictions tag description, as Predictions is a section inside the Trending tab.
  • SmokeConfirmations: Required per SmokePredictions tag description when selecting SmokePredictions.

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:
The changes are limited to a utility function that filters related tags for display as filter chips in the Predictions UI. This is a simple conditional check (skip if activeEventsCount === 0) with no performance implications. No performance-sensitive code paths are affected.

View GitHub Actions results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium AI analysis: medium risk size-S skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants