fix(charts): handle fast timeframe reloads in advanced chart cp-7.74.0#28985
Conversation
|
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. |
|
✅ E2E Fixture Validation — Schema is up to date |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
No E2E tests exist for the AdvancedChart component specifically. The component is used in AssetOverview/Price for token price chart display, but there are no E2E smoke tests targeting this chart functionality. The changes are isolated UI component bug fixes with no impact on:
The unit tests added alongside the fix provide adequate coverage for this behavioral change. No E2E tags are warranted. Performance Test Selection: |
|



Description
This PR fixes a post-merge regression in the advanced chart timeframe switch flow. After the recent remount based fix, there was still a race where a new OHLCV response could arrive before the remounted WebView finished loading. In that case, the stale snapshot guard could misclassify the already fresh candle array as stale and never send SET_OHLCV_DATA, leaving the new chart instance without data.
The fix narrows the stale snapshot logic so it captures only the previously synced OHLCV array at the moment the series key changes, instead of marking again whatever data happens to be in props later. This preserves the original protection against sending the previous range into the new WebView, while also allowing fast new range responses to sync correctly as soon as the remounted WebView finishes loading.
The PR also adds a focused regression test covering the fast-response / delayed-WebView-load case.
Changelog
CHANGELOG entry: Covered fast response / delayed WebView load case in stale snapshot guard
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
staleGuardTweak.mov
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
Medium Risk
Touches chart data synchronization and remount timing logic, which can impact whether users see up-to-date candles during timeframe switches. Changes are localized and backed by a targeted regression test.
Overview
Fixes a timeframe-switch race in
AdvancedChartwhere a fast newohlcvDataresponse could be incorrectly treated as “stale” during a WebView remount, preventingSET_OHLCV_DATAfrom ever being sent.The stale-snapshot guard is tightened to snapshot the previously synced OHLCV array at the moment
ohlcvSeriesKeychanges (instead of whatever happens to be in props later), and the extra early-return path on series-key change is removed so fresh data can sync once the new WebView finishes loading. Adds a regression test covering “fresh data arrives beforeonLoadEndafter series change.”Reviewed by Cursor Bugbot for commit 7c5303f. Bugbot is set up for automated code reviews on this repo. Configure here.