Skip to content

feat(predict): update liveline chart foundation#30003

Merged
matallui merged 1 commit into
mainfrom
predict/liveline-chart-foundation
May 12, 2026
Merged

feat(predict): update liveline chart foundation#30003
matallui merged 1 commit into
mainfrom
predict/liveline-chart-foundation

Conversation

@ghgoodreau

@ghgoodreau ghgoodreau commented May 11, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates the shared Liveline chart foundation used by the Predict crypto up/down work. It makes the React Native wrapper and WebView template support imperative live-point updates, queued messages before chart readiness, native loading behavior, and safer callback handling.

TODO

  1. This PR is stack item 1/3 and should merge before feat(predict): add crypto price data plumbing #30004 and feat(predict): add crypto up/down details UI #30005.
  2. Keep this PR as draft until the stacked PRs are validated and all required checks are passing.

Changelog

CHANGELOG entry: null

Related issues

Fixes: N/A - stacked Predict crypto up/down implementation split from #29436.

Manual testing steps

Feature: Liveline chart foundation

  Scenario: chart initializes and accepts live data updates
    Given a Predict screen renders a Liveline chart with historical data

    When the chart WebView becomes ready and live price points arrive
    Then the chart remains mounted and updates without showing an error state

Screenshots/Recordings

Before

N/A

After

N/A

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
Moderate risk because it changes the RN↔WebView messaging contract and rendering flow (adds queued imperative updates and live-mode state), which could affect chart correctness, loading states, and performance.

Overview
Updates LivelineChart to support an imperative ref API (appendPoint, clearData) that sends incremental WebView messages, queues them until CHART_READY, and flushes deterministically before firing onChartReady.

Extends the RN↔WebView protocol and template to handle APPEND_POINT/CLEAR_DATA, maintain a live-mode data buffer with merge/trim behavior, and optionally hide in-chart controls via the new hideControls prop (CSS body class).

Adjusts loading and callback handling: keeps a native loading overlay while loading is true, stabilizes onMessage while always using latest callback props, and adds dev-only PERF telemetry logging plus expanded unit tests for the new behaviors.

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

Co-authored-by: Cursor <cursoragent@cursor.com>
@ghgoodreau ghgoodreau self-assigned this May 11, 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.

@metamaskbotv2 metamaskbotv2 Bot added the team-swaps-and-bridge Swaps and Bridge team label May 11, 2026
@ghgoodreau ghgoodreau added team-predict Predict team labels May 11, 2026
@ghgoodreau ghgoodreau removed team-swaps-and-bridge Swaps and Bridge team size-L labels May 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are entirely contained within the app/components/UI/Charts/LivelineChart/ directory. The modifications include:

  1. LivelineChart.tsx: Refactored to use forwardRef/useImperativeHandle to expose imperative appendPoint and clearData methods, added message queuing for pre-ready state, callback ref pattern for stable onMessage, and PERF message logging.
  2. LivelineChart.types.ts: Added LivelineChartRef interface, expanded RNToWebViewMessage union with APPEND_POINT/CLEAR_DATA types, added PERF message type, and hideControls prop.
  3. LivelineChartTemplate.ts: Added live data mode with merge/trim helpers, new message handlers, hideControls CSS, and performance telemetry.
  4. index.ts: Exports the new LivelineChartRef type.
  5. Tests: Unit tests updated to cover new functionality.

Investigation confirmed that LivelineChart is not imported by any feature-level components outside its own directory. The only consumers are __demos__/LivelineDemo.tsx (a playground) and __tests__/LivelineChart.test.tsx (unit tests). The Perps feature uses a completely separate TradingViewChart component. No E2E test tags cover this component, and the changes don't affect any shared infrastructure, navigation, controllers, or user flows. No E2E tests need to run for these changes.

Performance Test Selection:
While the LivelineChart changes include performance telemetry (PERF message type tracking render times), the component itself is not currently used by any feature-level components that are covered by performance tests. The changes are self-contained within the chart component directory and don't affect account lists, onboarding, login, swaps, app launch, asset loading, predictions, or perps flows that are measured by performance tests.

View GitHub Actions results

@ghgoodreau ghgoodreau marked this pull request as ready for review May 11, 2026 20:16
@sonarqubecloud

Copy link
Copy Markdown

@matallui matallui added this pull request to the merge queue May 12, 2026
Merged via the queue into main with commit 4dcbb6f May 12, 2026
144 of 155 checks passed
@matallui matallui deleted the predict/liveline-chart-foundation branch May 12, 2026 21:19
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.78.0 Issue or pull request that will be included in release 7.78.0 team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants