Add health score columns + preview UX compaction#450
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a health score column to borrower and borrowed position tables, introduces column visibility configuration via a new settings modal, and refactors refresh UI controls into a dedicated header component. Health score computation and formatting utilities are added to support the new column. Changes
Sequence DiagramsequenceDiagram
participant User
participant BorrowedMorphoBlueTable
participant BorrowedTableSettingsModal
participant usePositionsPreferences
participant BorrowedMorphoBlueTable as Table Render
User->>BorrowedMorphoBlueTable: Click gear icon
BorrowedMorphoBlueTable->>BorrowedTableSettingsModal: Open modal
BorrowedTableSettingsModal->>usePositionsPreferences: Read borrowedTableColumnVisibility
usePositionsPreferences-->>BorrowedTableSettingsModal: Return current visibility state
BorrowedTableSettingsModal->>User: Display column toggles (healthScore, etc.)
User->>BorrowedTableSettingsModal: Toggle healthScore visibility
BorrowedTableSettingsModal->>usePositionsPreferences: Call setBorrowedTableColumnVisibility
usePositionsPreferences->>usePositionsPreferences: Update state & persist to localStorage
usePositionsPreferences-->>BorrowedMorphoBlueTable: Notify subscriber
BorrowedMorphoBlueTable->>Table Render: Re-render with updated visibility
Table Render-->>User: Show/hide Health Score column
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
🚥 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)
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.
🧹 Nitpick comments (1)
src/modals/borrow/components/withdraw-collateral-and-repay.tsx (1)
138-145: try-catch won't catch async errors here.
onSuccess(handleRefreshAll) usesPromise.allSettledwhich never rejects, so this is harmless. But the try-catch gives false confidence it's handling errors from the refresh operations. Consider removing it or making the callback async if error handling is actually desired.Option: simplify if no error handling needed
const handleRefresh = useCallback(() => { - if (!onSuccess) return; - try { - onSuccess(); - } catch (error) { - console.error('Failed to refresh data:', error); - } + onSuccess?.(); }, [onSuccess]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/modals/borrow/components/withdraw-collateral-and-repay.tsx` around lines 138 - 145, The try-catch in handleRefresh gives false confidence because onSuccess (the handleRefreshAll implementation) is async and uses Promise.allSettled, so synchronous try-catch won't capture async errors; either remove the try-catch entirely if you don't need error handling, or make handleRefresh async and await onSuccess() and then handle rejections (or inspect Promise.allSettled results) to log errors; locate the handler named handleRefresh and the async refresh function onSuccess/handleRefreshAll to apply the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/modals/borrow/components/withdraw-collateral-and-repay.tsx`:
- Around line 138-145: The try-catch in handleRefresh gives false confidence
because onSuccess (the handleRefreshAll implementation) is async and uses
Promise.allSettled, so synchronous try-catch won't capture async errors; either
remove the try-catch entirely if you don't need error handling, or make
handleRefresh async and await onSuccess() and then handle rejections (or inspect
Promise.allSettled results) to log errors; locate the handler named
handleRefresh and the async refresh function onSuccess/handleRefreshAll to apply
the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 859d1a70-208a-4a15-b33b-e571c001d13a
📒 Files selected for processing (15)
src/features/market-detail/components/borrower-table-column-visibility.tssrc/features/market-detail/components/borrower-table-settings-modal.tsxsrc/features/market-detail/components/borrowers-table.tsxsrc/features/positions/components/borrowed-morpho-blue-row-detail.tsxsrc/features/positions/components/borrowed-morpho-blue-table.tsxsrc/features/positions/components/borrowed-table-column-visibility.tssrc/features/positions/components/borrowed-table-settings-modal.tsxsrc/modals/borrow/components/add-collateral-and-borrow.tsxsrc/modals/borrow/components/borrow-position-risk-card.tsxsrc/modals/borrow/components/helpers.tssrc/modals/borrow/components/preview-section-header.tsxsrc/modals/borrow/components/withdraw-collateral-and-repay.tsxsrc/modals/leverage/components/add-collateral-and-leverage.tsxsrc/modals/leverage/components/remove-collateral-and-deleverage.tsxsrc/stores/usePositionsPreferences.ts
What this PR does
This PR introduces a normalized Health Score metric and improves preview readability/layout across borrow flows.
1) Health Score support (2-decimal display)
Health Score = LLTV / LTV> 1.00safer= 1.00liquidation boundary< 1.00liquidatable / high risk2) Market Detail → Top Borrowers
3) User Morpho Blue Borrow Positions table
4) Borrow/Repay/Leverage/Deleverage preview UX
Validation
pnpm typecheck✅pnpm lint:check✅ (existing non-blocking Biome INTERNAL warning may still appear in unrelated file)Notes
Summary by CodeRabbit
New Features
UI Improvements