Skip to content

fix: reset price on timeRange change cp-7.74.0#28982

Merged
sahar-fehri merged 1 commit into
mainfrom
fix/reset-price-on-timerange-change
Apr 17, 2026
Merged

fix: reset price on timeRange change cp-7.74.0#28982
sahar-fehri merged 1 commit into
mainfrom
fix/reset-price-on-timerange-change

Conversation

@sahar-fehri

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

Copy link
Copy Markdown
Contributor

Description

Fixes an issue where the price and percentage display would remain stuck at crosshair hover values after changing timeframes in the advanced chart.

Issue
When a user:

Hovers over the chart (which sets crosshair data)
Changes to a different timeframe (or clicks the same timeframe again)
The price and percentage display would incorrectly show the old crosshair values instead of resetting to show the current values for the new timeframe.

The crosshairData state was not being cleared when changing timeframes.

Solution
Added setCrosshairData(null) in the handleTimeRangeSelect callback to clear crosshair data whenever the timeframe changes.

Changelog

CHANGELOG entry: reset crosshair on timeRange change

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

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

Low Risk
Low risk UI-state fix that only clears crosshairData when switching chart time ranges, affecting display state but not data fetching or persistence.

Overview
Fixes the advanced token chart header getting stuck showing crosshair hover price/percentage after changing timeframes by clearing crosshairData in handleTimeRangeSelect before updating the selected range and tracking the event.

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

@sahar-fehri sahar-fehri requested a review from a team as a code owner April 17, 2026 15:01
@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.

@sahar-fehri sahar-fehri changed the title fix: reset price on timeRange change fix: reset price on timeRange change cp-7.74.0 Apr 17, 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 6a6551e. Configure here.

return;
}
// Clear crosshair data when changing timeframes to reset price/percentage display
setCrosshairData(null);

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.

Early return prevents crosshair reset on same timeframe

Medium Severity

The setCrosshairData(null) call is placed after the early return that fires when range === timeRange. The PR description explicitly mentions the scenario where a user "clicks the same timeframe again" as one of the cases to fix, but the early return on line 159 prevents setCrosshairData(null) from ever executing in that case. The crosshair data remains stale when re-selecting the current timeframe.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6a6551e. Configure here.

@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The change is a single-line bug fix in app/components/UI/AssetOverview/Price/Price.advanced.tsx. It adds setCrosshairData(null) when the user changes the chart timeframe, resetting the crosshair price/percentage display to avoid showing stale data from the previous timeframe.

This is a minimal, isolated UI fix:

  • No controller changes, no navigation changes, no shared infrastructure changes
  • Only affects the price chart crosshair state when switching timeframes in the token detail view
  • The AssetOverview component is used in token detail screens, which is part of the wallet's asset/token display functionality

SmokeWalletPlatform is selected because it covers token display and wallet platform features including transaction history and token details. No other tags are warranted given the extremely narrow scope of this change.

No performance tests are needed as this is a simple state reset (null assignment) with negligible performance impact.

Performance Test Selection:
The change is a single null assignment (setCrosshairData(null)) when switching chart timeframes. This has negligible performance impact and does not affect rendering performance, data loading, or any critical user flows measured by performance tests.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

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

@sahar-fehri sahar-fehri added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit c2248a8 Apr 17, 2026
121 of 126 checks passed
@sahar-fehri sahar-fehri deleted the fix/reset-price-on-timerange-change branch April 17, 2026 16:01
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.75.0 Issue or pull request that will be included in release 7.75.0 label Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.75.0 Issue or pull request that will be included in release 7.75.0 risk-low Low testing needed · Low bug introduction risk size-XS team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants