Skip to content

fix: football prediction markets not loading cp-7.78.0#30466

Merged
matallui merged 3 commits into
mainfrom
fix/prediction-markets-not-loading
May 20, 2026
Merged

fix: football prediction markets not loading cp-7.78.0#30466
matallui merged 3 commits into
mainfrom
fix/prediction-markets-not-loading

Conversation

@juanmigdr

@juanmigdr juanmigdr commented May 20, 2026

Copy link
Copy Markdown
Member

Description

Root cause: The Polymarket API returns null for the orderPriceMinTickSize field on some sports markets. Our code was calling .toString() on that value without a null check, which threw a runtime error. Since the entire batch of events was parsed in a single .map(), one bad event crashed the whole thing and returned an empty list.

Fix:

  1. Changed market.orderPriceMinTickSize.toString() to market.orderPriceMinTickSize?.toString() ?? '0.01' to safely handle the null.
  2. Updated the TypeScript type to number | null to correctly reflect what the API actually returns.
  3. Changed the event parsing loop from .map() to .flatMap() with a per-event try/catch, so a single malformed event is skipped and logged instead of taking down the whole batch.

Changelog

CHANGELOG entry: football prediction markets not loading

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3259

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

Screen.Recording.2026-05-20.at.18.52.11.mov

After

Screen.Recording.2026-05-20.at.18.53.10.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Medium Risk
Changes market parsing defaults and error handling for Polymarket events; while localized, it can affect tick-size-dependent pricing behavior and which events appear if parsing failures occur.

Overview
Fixes Polymarket sports markets failing to load when the API returns a null orderPriceMinTickSize.

Updates the Polymarket market type to allow orderPriceMinTickSize: number | null, safely derives tickSize with a fallback default, and makes parsePolymarketEvents resilient by parsing each event in a try/catch (logging and skipping only the bad event instead of failing the whole batch).

Reviewed by Cursor Bugbot for commit 1f8de4a. Bugbot is set up for automated code reviews on this repo. Configure here.

@juanmigdr juanmigdr requested a review from a team as a code owner May 20, 2026 16:21
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 20, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 a882672. Configure here.

Comment thread app/components/UI/Predict/providers/polymarket/utils.ts Outdated
@juanmigdr juanmigdr changed the title fix: football prediction markets not loading fix: football prediction markets not loading cp-7.78.0 May 20, 2026
@github-actions github-actions Bot added size-S and removed size-M labels May 20, 2026
@matallui matallui enabled auto-merge May 20, 2026 17:23
@matallui matallui removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 20, 2026
@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.

@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: medium
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The two changed files are scoped entirely to the Polymarket prediction market provider layer:

  1. types.ts: orderPriceMinTickSize type widened from number to number | null — reflects real API behavior where this field can be absent.

  2. utils.ts: Two bug fixes:

    • Null-safe access: market.orderPriceMinTickSize?.toString() ?? '0.01' prevents a crash when the API returns null for this field.
    • parsePolymarketEvents refactored from .map() to .flatMap() with a try/catch block — individual malformed events are now skipped with an error log instead of crashing the entire parsing pipeline.

These changes improve robustness of the Polymarket data parsing layer. SmokePredictions is the primary tag as it directly tests Polymarket prediction market flows (open positions, cash out, claim winnings, geo-restriction). Per the SmokePredictions tag description, SmokeWalletPlatform is required because Predictions is a section inside the Trending tab, and SmokeConfirmations is required because opening/closing positions are on-chain transactions.

Performance Test Selection:
The changes are limited to TypeScript type definitions and utility/parsing functions (null safety and error handling). There is no impact on UI rendering, data loading performance, list rendering, or any other performance-sensitive area. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@matallui matallui added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit e9fa454 May 20, 2026
162 of 176 checks passed
@matallui matallui deleted the fix/prediction-markets-not-loading branch May 20, 2026 19:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants