Skip to content

chore: fix outline pill on scroll back token details ac#28837

Merged
sahar-fehri merged 8 commits intomainfrom
fix/fix-custom-outline-pill-on-token-details-ac
Apr 16, 2026
Merged

chore: fix outline pill on scroll back token details ac#28837
sahar-fehri merged 8 commits intomainfrom
fix/fix-custom-outline-pill-on-token-details-ac

Conversation

@sahar-fehri
Copy link
Copy Markdown
Contributor

@sahar-fehri sahar-fehri commented Apr 14, 2026

Description

Fix advanced chart outline pill when panning / first load.

This updates the TradingView webview script (chartLogic.js) that drives the custom outline price pill (the hollow label on the price axis) so it shows and hides at the right times and doesn’t flicker when you scroll or when the chart first loads.

  • Panning to old history (oldest bars on the left)
    You’re looking at old bars; the newest bar is off the right. The outline should show.
    On main, sometimes the geometry still said “the marker would be in the plot” (or didn’t line up with which bars are actually loaded), so the app thought: “dot is still ‘there’, hide the outline.” (when it shouldn't) => cause regression
    So the outline disappeared when it should stay.

What the new code adds (why it fixes that)
isSeriesTailOffScreenByData — Looks at actual OHLCV: “Is the newest bar outside what counts as visible for the bars we have?” If yes, treat the tail as off-screen.
shouldHideVisibleEdgeOutlinePill — Show the outline if either geometry says the dot isn’t in the plot or data says the tail is off-screen (so you don’t rely on only coordinateToTime).

Changelog

CHANGELOG entry: fix showing outline pill on advanced charts on old history when chart head is visible.

Related issues

Fixes:

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

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

Medium Risk
Touches time/price scale math and visibility heuristics for TradingView overlays; bugs could cause the outline/last-close pills to misrender or flicker during pan/zoom and first load.

Overview
Fixes the advanced chart outline price pill so it shows reliably when users pan away from the latest bar and stops disappearing/flickering due to inconsistent time-scale geometry.

The outline pill visibility logic is reworked to combine a new plot-geometry check (isCustomLineEndMarkerVisibleInPlot) with a data-based fallback (isSeriesTailOffScreenByData), plus a more resilient “visible edge” bar selection (getVisibleEdgeOutlineBar). Line charts also now compute the outline price by interpolating the close at the plot’s right edge, and Y-coordinate mapping for pills is updated to support inverted and log price scales.

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

@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

E2E Fixture Validation — Schema is up to date
11 value mismatches detected (expected — fixture represents an existing user).
View details

@sahar-fehri sahar-fehri changed the base branch from fix/fallback-to-legacy-chart-if-empty-ohlcv-data to main April 15, 2026 20:36
@sahar-fehri sahar-fehri changed the base branch from main to fix/fallback-to-legacy-chart-if-empty-ohlcv-data April 15, 2026 20:37
Base automatically changed from fix/fallback-to-legacy-chart-if-empty-ohlcv-data to main April 16, 2026 10:20
@sahar-fehri sahar-fehri force-pushed the fix/fix-custom-outline-pill-on-token-details-ac branch from 9936df9 to b958011 Compare April 16, 2026 11:35
@sahar-fehri sahar-fehri marked this pull request as ready for review April 16, 2026 11:36
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Apr 16, 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 two changed files (chartLogic.js and chartLogicString.ts) are the source and string-serialized versions of the same WebView-internal JavaScript chart logic for the AdvancedChart component (a TradingView-based OHLCV chart). The changes are:

  1. Code quality refactoring: var → const/let throughout
  2. New helper functions for improved outline price pill visibility detection (shouldHideVisibleEdgeOutlinePill, isCustomLineEndMarkerVisibleInPlot, isSeriesTailOffScreenByData, getVisibleEdgeOutlineBar, getVisiblePlotRightEdgeTimeMs, interpolateCloseAlongLineAtTimeMs)
  3. Improved price Y coordinate calculation with log scale and inverted scale support
  4. Better fallback for visible range reading (getVisibleBarsRange → getVisibleRange fallback)
  5. Line chart price interpolation for the outline price pill

Investigation confirmed:

  • No E2E test files (.e2e., .spec.) reference AdvancedChart, chartLogic, OHLCV, TokenDetails, or AssetOverview
  • The AdvancedChart is used only in AssetOverview/Price and TokenDetails views — token detail screens not covered by any E2E test suite
  • These changes are entirely contained within WebView-internal JavaScript rendering logic
  • No controllers, Engine, navigation, wallet flows, confirmations, or shared infrastructure are affected
  • The changes are bug fixes/improvements to chart visual rendering (price pill positioning when panning historical data)

Since no E2E tests cover this component and the changes are isolated to WebView-internal chart rendering logic with no impact on any tested user flows, no E2E test tags need to be run.

Performance Test Selection:
The changes are confined to WebView-internal JavaScript chart rendering logic (price pill positioning, outline visibility, log scale Y coordinate calculation). These are visual rendering improvements within a TradingView WebView and do not affect app-level performance metrics like account list rendering, onboarding, login, swaps, app launch, or asset loading. No performance test tags are warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Copy Markdown
Member

@juanmigdr juanmigdr left a comment

Choose a reason for hiding this comment

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

I have tested locally and the PR fixes what is intended to fix. In terms of the math and code changes, I believe it has been developed correctly and trust @sahar-fehri's criteria

@sahar-fehri sahar-fehri added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Apr 16, 2026
@sahar-fehri sahar-fehri added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit 97e5846 Apr 16, 2026
105 of 110 checks passed
@sahar-fehri sahar-fehri deleted the fix/fix-custom-outline-pill-on-token-details-ac branch April 16, 2026 12:17
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.74.0 Issue or pull request that will be included in release 7.74.0 label Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.74.0 Issue or pull request that will be included in release 7.74.0 risk-low Low testing needed · Low bug introduction risk size-XL skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants