Conversation
WalkthroughThe PR adds an optional Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant ClaimList
participant RequestRedeemModal
participant JumperWidget
participant StatusSheet as useRequestRedeemStatusSheet
User->>ClaimList: click claim
ClaimList->>RequestRedeemModal: setSelectedClaim(formattedClaim)
RequestRedeemModal->>RequestRedeemModal: update selectedClaim state
RequestRedeemModal->>JumperWidget: change view / interact
JumperWidget->>RequestRedeemModal: onNavigationReady(navigationContext)
RequestRedeemModal->>RequestRedeemModal: store widgetNavigationRef
User->>StatusSheet: complete transaction
StatusSheet->>RequestRedeemModal: onCloseCallback()
RequestRedeemModal->>RequestRedeemModal: clear selectedClaim, reset amount, refetch LP
RequestRedeemModal->>JumperWidget: navigate to REQUEST_WITHDRAW (if needed)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
✅ All snapshot tests passed |
2a831ad to
ae8a88c
Compare
Playwright test resultsDetails
Flaky testschromium › mainMenu.spec.ts › Main Menu flows › Should open Resources section inside menu (Qase ID: 13) Skipped testschromium › themeManipulation.spec.ts › Switch between dark and light theme and check the background color › Partner theme should appear in theme menu and apply background color (Qase ID: 49) |
ae8a88c to
1be7913
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/components/composite/JumperWidget/JumperWidget.tsx (1)
324-326: Redundant object spread.
navigationContextis already a new object fromuseMemo, so spreading it into a new object is unnecessary.♻️ Suggested simplification
useEffect(() => { - onNavigationReady?.({ ...navigationContext }); + onNavigationReady?.(navigationContext); }, [navigationContext, onNavigationReady]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/composite/JumperWidget/JumperWidget.tsx` around lines 324 - 326, The useEffect in JumperWidget currently calls onNavigationReady?.({ ...navigationContext }) and unnecessarily spreads navigationContext (which is already a fresh object from useMemo); change the effect to call onNavigationReady?.(navigationContext) instead so you pass the memoized object directly (keep the effect and dependency array [navigationContext, onNavigationReady] unchanged), locating this change in the useEffect block where onNavigationReady is invoked.src/components/composite/RequestRedeemModal/RequestRedeemModal.tsx (1)
148-160: WraponCloseCallbackinuseCallbackto prevent unnecessary re-renders.The inline function creates a new reference on every render, causing
handleCloseSuccessandopenSheetinuseRequestRedeemStatusSheetto be recreated on each render cycle.♻️ Suggested fix
+ const handleCloseSuccess = useCallback(() => { + setSelectedClaim(null); + handleResetAmount(); + refetchLpTokenAmount(); + if ( + widgetNavigationRef.current?.currentViewId !== + RequestRedeemModalView.REQUEST_WITHDRAW + ) { + widgetNavigationRef.current?.goToView( + RequestRedeemModalView.REQUEST_WITHDRAW, + ); + } + }, [handleResetAmount, refetchLpTokenAmount]); + const statusSheet = useRequestRedeemStatusSheet({ transactionForm, isClaimFlow, selectedClaimToTokenBalance, requestWithdrawToTokenBalance, - onCloseCallback: () => { - setSelectedClaim(null); - handleResetAmount(); - refetchLpTokenAmount(); - if ( - widgetNavigationRef.current?.currentViewId !== - RequestRedeemModalView.REQUEST_WITHDRAW - ) { - widgetNavigationRef.current?.goToView( - RequestRedeemModalView.REQUEST_WITHDRAW, - ); - } - }, + onCloseCallback: handleCloseSuccess, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/composite/RequestRedeemModal/RequestRedeemModal.tsx` around lines 148 - 160, The inline onCloseCallback prop is recreated every render causing downstream hooks (like useRequestRedeemStatusSheet's handleCloseSuccess and openSheet) to re-create; wrap the onCloseCallback in useCallback (e.g., const onCloseCallback = useCallback(() => { setSelectedClaim(null); handleResetAmount(); refetchLpTokenAmount(); if (widgetNavigationRef.current?.currentViewId !== RequestRedeemModalView.REQUEST_WITHDRAW) { widgetNavigationRef.current?.goToView(RequestRedeemModalView.REQUEST_WITHDRAW); } }, [setSelectedClaim, handleResetAmount, refetchLpTokenAmount, widgetNavigationRef]) and pass that memoized onCloseCallback where currently provided so the reference remains stable between renders.
🤖 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/components/composite/JumperWidget/JumperWidget.tsx`:
- Around line 324-326: The useEffect in JumperWidget currently calls
onNavigationReady?.({ ...navigationContext }) and unnecessarily spreads
navigationContext (which is already a fresh object from useMemo); change the
effect to call onNavigationReady?.(navigationContext) instead so you pass the
memoized object directly (keep the effect and dependency array
[navigationContext, onNavigationReady] unchanged), locating this change in the
useEffect block where onNavigationReady is invoked.
In `@src/components/composite/RequestRedeemModal/RequestRedeemModal.tsx`:
- Around line 148-160: The inline onCloseCallback prop is recreated every render
causing downstream hooks (like useRequestRedeemStatusSheet's handleCloseSuccess
and openSheet) to re-create; wrap the onCloseCallback in useCallback (e.g.,
const onCloseCallback = useCallback(() => { setSelectedClaim(null);
handleResetAmount(); refetchLpTokenAmount(); if
(widgetNavigationRef.current?.currentViewId !==
RequestRedeemModalView.REQUEST_WITHDRAW) {
widgetNavigationRef.current?.goToView(RequestRedeemModalView.REQUEST_WITHDRAW);
} }, [setSelectedClaim, handleResetAmount, refetchLpTokenAmount,
widgetNavigationRef]) and pass that memoized onCloseCallback where currently
provided so the reference remains stable between renders.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1f1e1bc9-a788-4a15-a542-81e31ba73c7d
📒 Files selected for processing (5)
src/components/composite/JumperWidget/JumperWidget.tsxsrc/components/composite/RequestRedeemModal/RequestRedeemModal.tsxsrc/components/composite/RequestRedeemModal/components/ClaimList.tsxsrc/components/composite/RequestRedeemModal/hooks/useFormatRedeemClaimData.tssrc/components/composite/RequestRedeemModal/hooks/useRequestRedeemStatusSheet.tsx
yordanove
left a comment
There was a problem hiding this comment.
Code reviewed — fix looks correct. After claim success, the onCloseCallback now resets the selected claim, amount, and navigates back to the REQUEST_WITHDRAW view instead of staying on the $0/$0 screen.
Couldn't functionally test due to Lido withdrawal confirmation timing (1-3 days). Prepared a withdrawal transaction for testing once confirmed:
1be7913 to
4e408b9
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/composite/RequestRedeemModal/RequestRedeemModal.tsx (1)
150-162: Consider wrappingonCloseCallbackinuseCallbackfor stability.The inline arrow function creates a new reference on every render. If
useRequestRedeemStatusSheetuses this callback in dependencies or memoization, it could trigger unnecessary re-renders or effect re-executions.♻️ Suggested refactor
+ const handleStatusSheetClose = useCallback(() => { + setSelectedClaim(null); + handleResetAmount(); + refetchLpTokenAmount(); + if ( + widgetNavigationRef.current?.currentViewId !== + RequestRedeemModalView.REQUEST_WITHDRAW + ) { + widgetNavigationRef.current?.goToView( + RequestRedeemModalView.REQUEST_WITHDRAW, + ); + } + }, [handleResetAmount, refetchLpTokenAmount]); const statusSheet = useRequestRedeemStatusSheet({ transactionForm, isClaimFlow, selectedClaimToTokenBalance, requestWithdrawToTokenBalance, - onCloseCallback: () => { - setSelectedClaim(null); - handleResetAmount(); - refetchLpTokenAmount(); - if ( - widgetNavigationRef.current?.currentViewId !== - RequestRedeemModalView.REQUEST_WITHDRAW - ) { - widgetNavigationRef.current?.goToView( - RequestRedeemModalView.REQUEST_WITHDRAW, - ); - } - }, + onCloseCallback: handleStatusSheetClose, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/composite/RequestRedeemModal/RequestRedeemModal.tsx` around lines 150 - 162, Wrap the inline onCloseCallback in useCallback to stabilize its identity: create a memoized callback using React.useCallback named onCloseCallback that performs setSelectedClaim(null), handleResetAmount(), refetchLpTokenAmount(), and the widgetNavigationRef view check/goToView logic, and pass that memoized function to useRequestRedeemStatusSheet (or wherever it’s used). Use dependencies [setSelectedClaim, handleResetAmount, refetchLpTokenAmount, widgetNavigationRef, RequestRedeemModalView] (omit .current access) so the callback updates only when those symbols 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/components/composite/RequestRedeemModal/RequestRedeemModal.tsx`:
- Around line 150-162: Wrap the inline onCloseCallback in useCallback to
stabilize its identity: create a memoized callback using React.useCallback named
onCloseCallback that performs setSelectedClaim(null), handleResetAmount(),
refetchLpTokenAmount(), and the widgetNavigationRef view check/goToView logic,
and pass that memoized function to useRequestRedeemStatusSheet (or wherever it’s
used). Use dependencies [setSelectedClaim, handleResetAmount,
refetchLpTokenAmount, widgetNavigationRef, RequestRedeemModalView] (omit
.current access) so the callback updates only when those symbols change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 27bae367-c8a3-4919-b619-8edcc2bb3dc8
📒 Files selected for processing (5)
src/components/composite/JumperWidget/JumperWidget.tsxsrc/components/composite/RequestRedeemModal/RequestRedeemModal.tsxsrc/components/composite/RequestRedeemModal/components/ClaimList.tsxsrc/components/composite/RequestRedeemModal/hooks/useFormatRedeemClaimData.tssrc/components/composite/RequestRedeemModal/hooks/useRequestRedeemStatusSheet.tsx
✅ Files skipped from review due to trivial changes (1)
- src/components/composite/RequestRedeemModal/hooks/useFormatRedeemClaimData.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/components/composite/JumperWidget/JumperWidget.tsx
- src/components/composite/RequestRedeemModal/hooks/useRequestRedeemStatusSheet.tsx
- src/components/composite/RequestRedeemModal/components/ClaimList.tsx
Which Jira task belongs to this PR?
Closes https://linear.app/lifi-linear/issue/JUM-716/withdraw-position-screen-shows-dollar0dollar0-with-active-withdraw
Why did I implement it this way?
Checklist before requesting a review
Summary by CodeRabbit
New Features
Refactor