Skip to content

Conversation

@petar-omni
Copy link
Collaborator

Fixes ENG-1176

@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
perps-widget Ready Ready Preview, Comment Jan 27, 2026 5:24pm

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes ENG-1176 by improving TradingView chart symbol resolution so the chart uses the correct provider + symbol pair instead of a hardcoded fallback.

Changes:

  • Refactors the Position Details chart into a new Overview/Chart module that resolves providerId:symbol via a generated mapping.
  • Adds tradingview-symbols.json + a generator script to produce/refresh the mapping.
  • Centralizes and preloads the TradingView widget script URL to reduce load latency.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/services/constants.ts Introduces a shared TradingView widget script URL constant.
src/app.tsx Preloads the TradingView script at app start.
src/components/modules/PositionDetails/Overview/index.tsx Switches to the new named Chart export/module.
src/components/modules/PositionDetails/Overview/chart.tsx Removes the old chart implementation.
src/components/modules/PositionDetails/Overview/Chart/state.ts Adds symbol mapping atom + chart interval constants.
src/components/modules/PositionDetails/Overview/Chart/index.tsx New chart implementation that embeds TradingView using provider/symbol mapping and updates interval via postMessage.
src/assets/tradingview-symbols.json Adds the provider/symbol mapping dataset used by the chart.
scripts/generate-tradingview-symbols.ts Adds a script to generate/update the mapping JSON from Perps + TradingView search.
src/components/molecules/token-balances-select.tsx Removes unnecessary useCallback usage.
src/components/molecules/provider-select.tsx Removes unnecessary useCallback usage.
package.json Adds a generate-tradingview-symbols script entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +134 to +137
iframeRef.current.contentWindow.postMessage(
{ name: "set-interval", data: { interval: newInterval } },
"*",
);
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

postMessage is sent with targetOrigin "*". Since the message is intended only for the TradingView iframe, it would be safer to restrict targetOrigin to the iframe's actual origin (e.g. derive it from iframeRef.current.src) to avoid sending messages if the iframe navigates to a different origin.

Copilot uses AI. Check for mistakes.
@petar-omni petar-omni merged commit a531603 into main Jan 27, 2026
8 checks passed
@petar-omni petar-omni deleted the fix/chart-symbol-mapping branch January 27, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants