fix(predict): handle missing sports market labels cp-7.80.0#30946
Conversation
Add fallback handling for missing sports market translations so Predict cards use outcome titles instead of rendering i18n missing markers. For line markets, use the currently selected line outcome title. Add English labels for basketball and tennis market types, and cover translated and fallback behavior in Predict game outcome tests.
|
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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78fe218. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
SmokePredictions is the primary tag since these changes directly affect Polymarket prediction market UI and data parsing. Per SmokePredictions tag description, SmokeWalletPlatform (Trending section where Predictions is embedded) and SmokeConfirmations (on-chain transactions for opening/closing positions) must also be selected. No other feature areas are affected - no changes to navigation, shared components, controllers, or other feature modules. Performance Test Selection: |

Description
This PR fixes missing and unsafe sports market labels in Predict game details.
It adds a runtime safeguard for sports market type translations so cards no longer render i18n missing markers when Polymarket ships a new market type before the locale file is updated. When a translation is missing, the UI falls back to the outcome title; for line markets, it uses the currently selected line outcome title. Missing sports market translation keys are logged once per app session with the full i18n key so locale gaps can be discovered without spamming repeated renders.
It also adds English labels for known basketball and tennis market types:
basketball_total_points:Totalsbasketball_odd_even:Odd/Even Scorebasketball_team_to_score_first:Team to Score Firsttennis_set_handicap:Set HandicapFinally, it hardens the Polymarket parser for search/feed responses where spread markets may omit
groupItemTitle. In that case, parsing now falls back tomarket.questionbefore formatting the spread title, preventingreplacefrom being called onundefined.Automated validation:
Result: 2 test suites passed, 88 tests passed.
Changelog
CHANGELOG entry: Fixed missing Predict sports market labels and prevented a search result parsing error for some sports markets
Related issues
Fixes: PRED-944
Manual testing steps
Screenshots/Recordings
Before
Observed missing translation markers in Predict sports market cards and a runtime parser error while searching sports markets.
After
Sports market cards render translated labels or outcome-title fallbacks, missing translation keys are logged once, and search parsing handles missing spread group titles without throwing.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
UI/i18n and defensive parsing in Predict sports flows; no auth, payments, or trading logic changes.
Overview
Improves Predict sports game details when Polymarket exposes market types or API fields before locales and parsers are fully aligned.
PredictGameOutcomesTabnow resolves sports market type labels via translation, then an optional outcome title fallback, then title-cased type keys. Missing i18n (raw key or[missingmarkers) is logged once per key throughLogger.errorinstead of showing broken copy on cards. Line cards use the selected line’s formatted outcome title when the market type has no translation; subgroup and flat moneyline paths pass the same fallbacks.en.jsonadds English strings for basketball (basketball_total_points,basketball_odd_even,basketball_team_to_score_first) andtennis_set_handicap.Polymarket
formatMarketGroupItemTitleusesgroupItemTitle ?? question ?? ''so spread markets withoutgroupItemTitleno longer throw during search/parse; spread formatting still strips the dash before the line number.Tests cover label fallbacks, deduped logging, UI titles for unknown types/lines, and spread parsing without
groupItemTitle.Reviewed by Cursor Bugbot for commit f242305. Bugbot is set up for automated code reviews on this repo. Configure here.