Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughRate and Volume chart components now build chart series with stricter null-safety, derive current "now" values from live Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)src/features/market-detail/components/charts/volume-chart.tsx (2)
🔇 Additional comments (5)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/features/market-detail/components/charts/volume-chart.tsx`:
- Around line 99-106: getVolumeStats and the nowPoint construction mix
asset-unit current values with USD historical points when volumeView === 'USD';
fix by ensuring current and nowPoint use USD-denominated numbers: in
getVolumeStats, when volumeView === 'USD' compute current from USD equivalents
(e.g., market.state.supplyAssetsUsd / borrowAssetsUsd / liquidityAssetsUsd) or
convert asset units to USD via the same price feed used for historical points
before running netChangePercentage, and in the nowPoint block only append USD
values (use supplyAssetsUsd/borrowAssetsUsd/liquidityAssetsUsd or converted
values) or skip appending nowPoint when USD equivalents are unavailable; update
references to volumeView, getVolumeStats, nowPoint and market.state to apply the
USD conversion or conditional append so units match between current and
historical data.
🧹 Nitpick comments (1)
src/features/market-detail/components/charts/volume-chart.tsx (1)
121-125: Move constant outside component.
STATE_KEY_MAPis recreated each render. Hoist it to module scope.+const STATE_KEY_MAP = { + supply: 'supplyAssets', + borrow: 'borrowAssets', + liquidity: 'liquidityAssets', +} as const; + function VolumeChart({ marketId, chainId, market }: VolumeChartProps) { ... - const STATE_KEY_MAP = { - supply: 'supplyAssets', - borrow: 'borrowAssets', - liquidity: 'liquidityAssets', - } as const;
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/features/market-detail/components/charts/rate-chart.tsxsrc/features/market-detail/components/charts/volume-chart.tsx
🧰 Additional context used
🧬 Code graph analysis (2)
src/features/market-detail/components/charts/rate-chart.tsx (2)
src/utils/types.ts (1)
TimeseriesDataPoint(336-339)src/utils/rateMath.ts (1)
convertApyToApr(15-29)
src/features/market-detail/components/charts/volume-chart.tsx (2)
src/utils/types.ts (1)
TimeseriesDataPoint(336-339)src/utils/balance.ts (1)
formatReadable(25-49)
🔇 Additional comments (7)
src/features/market-detail/components/charts/rate-chart.tsx (4)
47-70: Null-safety logic looks solid.The filtering approach handles potentially malformed data well. One minor note: lines 59-60 use
?? 0fallback, but the null check on line 54 already ensures these values aren't null. The fallback is harmless but redundant.
76-81: Good defensive filtering for averages.Worth noting:
TimeseriesDataPoint.yis typed asnumber(not nullable) insrc/utils/types.ts. If nulls are expected at runtime, consider updating the type definition toy: number | nullfor accuracy.
132-132: Direct state setter is cleaner.Removes indirection. Type assertion is safe given the constrained SelectItem values.
160-162: LGTM.Using memoized
chartDatadirectly.src/features/market-detail/components/charts/volume-chart.tsx (3)
64-73: Good fallback for missing data.Returns single point with current state. Same USD/Asset concern applies here though - if
volumeView === 'USD', these values won't be in USD units.
79-97: Null filtering is appropriate.Type guard and outlier filter (100B USD threshold) look reasonable.
221-221: Consistent with rate-chart.Direct setter, type assertion safe.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Summary by CodeRabbit
Bug Fixes
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.