Skip to content

Conversation

@memoyil
Copy link
Collaborator

@memoyil memoyil commented Oct 20, 2025


PR-Codex overview

This PR focuses on enhancing the TradingViewChart component by introducing a new function for widget overrides based on the theme, improving the handling of theme changes, and debouncing updates to prevent excessive widget recreation.

Detailed summary

  • Added getWidgetOverrides function to manage theme-based widget properties.
  • Replaced inline overrides in options with a call to getWidgetOverrides.
  • Integrated useLastUpdated hook to manage refresh state.
  • Updated effect dependencies to include lastUpdated.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}


Note

Centralizes TradingView widget overrides, adds lastUpdated-driven refresh, and ensures theme overrides are reapplied when the widget becomes ready or the theme changes.

  • Chart (apps/web/src/components/Chart/TradingViewChart.tsx)
    • Overrides refactor: Extracts theme-specific widget overrides to getWidgetOverrides(isDark) and uses it for both widget initialization (overrides) and runtime updates (applyOverrides).
    • Reliable theme reapply: Integrates useLastUpdated; triggers refresh() when the widget becomes ready and includes lastUpdated in the theme effect deps to force reapplication after readiness changes.
    • Behavioral tweaks:
      • Reapplies theme via changeTheme with changeTheme(...), applyOverrides(getWidgetOverrides(isDark)).
      • Minor cleanup of duplicated override blocks and ensures widget recreation only when currency addresses change.

Written by Cursor Bugbot for commit 45edafd. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2025

⚠️ No Changeset found

Latest commit: 45edafd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 20, 2025

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

Project Deployment Preview Comments Updated (UTC)
web Ready Ready Preview Comment Nov 13, 2025 3:38pm
8 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
aptos-web Ignored Ignored Nov 13, 2025 3:38pm
blog Ignored Ignored Nov 13, 2025 3:38pm
bridge Ignored Ignored Nov 13, 2025 3:38pm
games Ignored Ignored Nov 13, 2025 3:38pm
gamification Ignored Ignored Nov 13, 2025 3:38pm
solana Ignored Ignored Nov 13, 2025 3:38pm
ton Ignored Ignored Nov 13, 2025 3:38pm
uikit Ignored Ignored Nov 13, 2025 3:38pm

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on November 28

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

}
changeTheme()
}, [isDark, theme])
}, [isDark, theme, lastUpdated])
Copy link

Choose a reason for hiding this comment

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

Bug: Theme Change Effect Triggered Incorrectly

The changeTheme effect dependency array includes lastUpdated (line 383), but refresh() is called during widget initialization (lines 335 and 345). This causes the theme change effect to execute whenever the widget becomes ready, not just when the theme actually changes. The lastUpdated dependency should be removed from the effect dependency array, as lastUpdated is not related to theme changes and its inclusion creates unintended effect triggers during widget initialization.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

lastUpdated needed to trigger to force to change the theme, when rerender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants