Skip to content

fix(rfox): keep WETH/FOX tab visible during LP unstake cooldown and claim#12382

Merged
kaladinlight merged 3 commits into
developfrom
fix/rfox-keep-lp-tab-during-claim-state
May 26, 2026
Merged

fix(rfox): keep WETH/FOX tab visible during LP unstake cooldown and claim#12382
kaladinlight merged 3 commits into
developfrom
fix/rfox-keep-lp-tab-during-claim-state

Conversation

@kaladinlight
Copy link
Copy Markdown
Member

@kaladinlight kaladinlight commented May 26, 2026

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 == 0 but the user still needs the legacy UI:

  1. Cooldown pending — user requested unstake, tokens are in unstakingBalance waiting out the cooldown
  2. Ready to claim — cooldown expired, but the user hasn't submitted the claim tx yet

In 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. useGetUnstakingRequestsQuery is already called in this file for hasClaimableRequests, and each UnstakingRequest carries its stakingAssetId, 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.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

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:

  1. No LP position — connect a wallet that never staked LP, navigate to FOX Token Dashboard → rFOX:
    • WETH/FOX pill NOT visible
    • "Program Ended" warning NOT visible
  2. Active LP stake (regression from fix(rfox): hide WETH/FOX tab and sunset warning when no LP balance #12363):
    • WETH/FOX pill visible
    • "Program Ended" warning visible
  3. LP unstake requested, cooldown pending (stakingBalance == 0, unstaking request open):
    • WETH/FOX pill still visible (new behavior — was hidden before this PR)
    • "Program Ended" warning still visible
    • Clicking WETH/FOX switches to the LP view; Claim button is disabled (cooldown not expired)
  4. LP unstake requested, cooldown expired (stakingBalance == 0, claimable request open):
    • WETH/FOX pill still visible
    • "Program Ended" warning still visible
    • Claim button enabled; claim flow completes successfully
  5. After claim (no balance, no requests):
    • WETH/FOX pill NOT visible
    • "Program Ended" warning NOT visible

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

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

  • Bug Fixes
    • LP-related information and UI elements now display correctly for users with pending unstaking requests, in addition to active staking positions.

Review Change Stack

…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>
@kaladinlight kaladinlight requested a review from a team as a code owner May 26, 2026 16:34
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

@kaladinlight, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a1147b8f-c1b4-42d0-8a20-d713984faa86

📥 Commits

Reviewing files that changed from the base of the PR and between d0ed0b9 and 6087317.

📒 Files selected for processing (1)
  • src/pages/Fox/components/RFOXSection.tsx
📝 Walkthrough

Walkthrough

RFOXSection now detects LP positions by checking both LP staking balance and pending unstaking requests. A new allUnstakingRequestsQuery hook scans for unstaking requests, and the derived hasLpPosition flag gates both the token filter expansion and LP sunset warning card visibility.

Changes

LP Position Detection with Unstaking Requests

Layer / File(s) Summary
LP position detection and application
src/pages/Fox/components/RFOXSection.tsx
Introduces allUnstakingRequestsQuery and computes hasLpPosition as a union of staking balance and unstaking request status. Applies this expanded check to the filter-building early return, memo dependencies, and LP sunset warning card visibility condition.

Sequence Diagram

sequenceDiagram
  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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • shapeshift/web#12363: Both PRs update src/pages/Fox/components/RFOXSection.tsx to conditionally render the LP token filter and the LP sunset warning, but this PR extends the condition from "LP staking balance only" to "LP position including unstaking requests."

Poem

🐰 A fox's LP position now sees both ways—
Active stakes and unstaking requests at play,
The token filter blooms when either appears,
The sunset warning shines through pending years,
Position detection grows wise and complete! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: keeping the WETH/FOX tab visible during LP unstake cooldown and claim states, which directly corresponds to the code changes that gate UI visibility on both LP staking balance and LP unstaking request status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rfox-keep-lp-tab-during-claim-state

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/pages/Fox/components/RFOXSection.tsx (1)

187-187: 💤 Low value

Consider memoizing hasLpPosition to align with coding guidelines.

The guideline states "ALWAYS use useMemo for derived values and computed properties." While the performance impact of a boolean OR is negligible, wrapping it in useMemo would ensure full guideline compliance.

♻️ Optional refactor
-  const hasLpPosition = hasLpStakingBalance || hasLpUnstakingRequests
+  const hasLpPosition = useMemo(
+    () => hasLpStakingBalance || hasLpUnstakingRequests,
+    [hasLpStakingBalance, hasLpUnstakingRequests],
+  )

As per coding guidelines: "ALWAYS use useMemo for derived values and computed properties" and "ALWAYS use useMemo for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f30fe8 and d0ed0b9.

📒 Files selected for processing (1)
  • src/pages/Fox/components/RFOXSection.tsx

@kaladinlight kaladinlight enabled auto-merge (squash) May 26, 2026 16:43
@kaladinlight kaladinlight merged commit f812b8f into develop May 26, 2026
4 checks passed
@kaladinlight kaladinlight deleted the fix/rfox-keep-lp-tab-during-claim-state branch May 26, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant