fix(rfox): keep WETH/FOX tab visible during LP unstake cooldown and claim#12382
Conversation
…laim #12363 hid the WETH/FOX filter pill and "Program Ended" warning when the LP staking balance was zero. The LP unstake lifecycle has two post-stake states where `stakingBalance == 0` but the user still needs the legacy UI: - Cooldown pending — funds in unstakingBalance, waiting on cooldown - Ready to claim — cooldown expired, claim tx not yet submitted In both states the user would lose any entry point to the WETH/FOX tab where Claim lives. Widen the gate to include LP-specific unstaking requests so the tab and warning stay until the user has fully exited. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 26 minutes and 56 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesLP Position Detection with Unstaking Requests
Sequence DiagramsequenceDiagram
participant Component as RFOXSection
participant AllUnstakingQuery as allUnstakingRequestsQuery
participant HasLpPosition as hasLpPosition
participant TokenFilter as token filter
participant SunsetWarning as LP sunset warning
Component->>AllUnstakingQuery: fetch unstaking requests for LP asset
AllUnstakingQuery-->>Component: unstaking requests data
Component->>HasLpPosition: compute from staking balance + unstaking requests
HasLpPosition-->>Component: hasLpPosition flag
Component->>TokenFilter: show LP token if hasLpPosition
Component->>SunsetWarning: show card if hasLpPosition
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
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 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/pages/Fox/components/RFOXSection.tsx (1)
187-187: 💤 Low valueConsider memoizing
hasLpPositionto align with coding guidelines.The guideline states "ALWAYS use
useMemofor derived values and computed properties." While the performance impact of a boolean OR is negligible, wrapping it inuseMemowould ensure full guideline compliance.♻️ Optional refactor
- const hasLpPosition = hasLpStakingBalance || hasLpUnstakingRequests + const hasLpPosition = useMemo( + () => hasLpStakingBalance || hasLpUnstakingRequests, + [hasLpStakingBalance, hasLpUnstakingRequests], + )As per coding guidelines: "ALWAYS use
useMemofor derived values and computed properties" and "ALWAYS useuseMemofor conditional values and simple transformations."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/Fox/components/RFOXSection.tsx` at line 187, The derived boolean hasLpPosition is computed directly from hasLpStakingBalance || hasLpUnstakingRequests and should be memoized to follow the guideline; change its definition to use React's useMemo (ensure useMemo is imported) so hasLpPosition = useMemo(() => hasLpStakingBalance || hasLpUnstakingRequests, [hasLpStakingBalance, hasLpUnstakingRequests]) which keeps behavior identical but conforms to the rule for derived/conditional values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/pages/Fox/components/RFOXSection.tsx`:
- Line 187: The derived boolean hasLpPosition is computed directly from
hasLpStakingBalance || hasLpUnstakingRequests and should be memoized to follow
the guideline; change its definition to use React's useMemo (ensure useMemo is
imported) so hasLpPosition = useMemo(() => hasLpStakingBalance ||
hasLpUnstakingRequests, [hasLpStakingBalance, hasLpUnstakingRequests]) which
keeps behavior identical but conforms to the rule for derived/conditional
values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f91052c9-61f1-47c9-a377-bb8c2326046a
📒 Files selected for processing (1)
src/pages/Fox/components/RFOXSection.tsx
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Description
Follow-up to #12363, which hid the WETH/FOX filter pill and "Program Ended" warning when the LP staking balance is zero.
The LP unstake lifecycle has two post-stake states where
stakingBalance == 0but the user still needs the legacy UI:unstakingBalancewaiting out the cooldownIn both states the WETH/FOX tab + warning would be hidden by #12363, leaving the user with no entry point to the Claim flow for their LP position.
This PR widens the gate to also keep the tab/warning visible when the account has any LP-specific unstaking request outstanding.
useGetUnstakingRequestsQueryis already called in this file forhasClaimableRequests, and eachUnstakingRequestcarries itsstakingAssetId, so this is a small additive check (no new network call).Issue (if applicable)
closes #
Risk
Low — read-only UI change in the rFOX dashboard. No on-chain transactions or contract interaction changes. Only widens an existing visibility predicate.
rFOX LP (WETH/FOX) UI only. No contract calls added or modified.
Testing
Engineering
Walk an account through the LP lifecycle and verify the WETH/FOX tab + sunset warning behavior at each step:
stakingBalance == 0, unstaking request open):stakingBalance == 0, claimable request open):Operations
QA: walk through the LP unstake → cooldown → claim flow on an account with leftover WETH/FOX, and confirm the WETH/FOX pill and sunset warning remain visible at each step until the claim is submitted.
Screenshots (if applicable)
Summary by CodeRabbit