From a6d0c7f7e4fae1d0f8c2407a2f84c5d356e9ddba Mon Sep 17 00:00:00 2001 From: kaladinlight <35275952+kaladinlight@users.noreply.github.com> Date: Fri, 31 Jul 2026 15:25:55 -0600 Subject: [PATCH] fix: runepool position loading on account pages + view position redirect Account/asset pages render the DeFi section without anything mounting the opportunities fetch, so the RUNEPool row balance and overview modal relied on persisted state - wiped by the savers-removal migration, leaving an infinite spinner. Mount useFetchOpportunities alongside the section (deduped with the earn dashboard by the shared query key). View position now routes to the asset account page instead of the legacy chain account page, whose sidebar has never laid out beside the content. Co-Authored-By: Claude Fable 5 --- src/components/StakingVaults/EarnOpportunities.tsx | 4 ++++ .../RunePoolManager/Deposit/components/Status.tsx | 8 ++++---- .../RunePoolManager/Withdraw/components/Status.tsx | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/StakingVaults/EarnOpportunities.tsx b/src/components/StakingVaults/EarnOpportunities.tsx index 068cfbfd3b9..e320c2f60b7 100644 --- a/src/components/StakingVaults/EarnOpportunities.tsx +++ b/src/components/StakingVaults/EarnOpportunities.tsx @@ -5,6 +5,7 @@ import qs from 'qs' import { useCallback, useEffect, useMemo } from 'react' import { useLocation } from 'react-router-dom' +import { useFetchOpportunities } from './hooks/useFetchOpportunities' import { StakingTable } from './StakingTable' import { Text } from '@/components/Text' @@ -30,6 +31,9 @@ type EarnOpportunitiesProps = { } export const EarnOpportunitiesContent = ({ assetId, accountId }: EarnOpportunitiesProps) => { + // Account/asset pages render this section without the earn dashboard mounted, so fetch here too + useFetchOpportunities() + const { navigate } = useBrowserRouter() const location = useLocation() const { diff --git a/src/features/defi/providers/runepool/components/RunePoolManager/Deposit/components/Status.tsx b/src/features/defi/providers/runepool/components/RunePoolManager/Deposit/components/Status.tsx index f25e6402c0d..3eec51340ea 100644 --- a/src/features/defi/providers/runepool/components/RunePoolManager/Deposit/components/Status.tsx +++ b/src/features/defi/providers/runepool/components/RunePoolManager/Deposit/components/Status.tsx @@ -97,10 +97,10 @@ export const Status: React.FC = ({ accountId }) => { }, [accountId, appDispatch, contextDispatch, getOpportunitiesUserData, state?.txid]) const handleViewPosition = useCallback(() => { - if (!accountId) return - // The full-page earn dashboard is mobile-only - the account page shows the position on both layouts - navigate(`/accounts/${accountId}`) - }, [accountId, navigate]) + if (!accountId || !assetId) return + // The full-page earn dashboard is mobile-only - the asset account page shows the position on both layouts + navigate(`/accounts/${accountId}/${assetId}`) + }, [accountId, assetId, navigate]) const handleCancel = useCallback(() => { navigate(-1) diff --git a/src/features/defi/providers/runepool/components/RunePoolManager/Withdraw/components/Status.tsx b/src/features/defi/providers/runepool/components/RunePoolManager/Withdraw/components/Status.tsx index 7b7fe612019..c0dac51fd5b 100644 --- a/src/features/defi/providers/runepool/components/RunePoolManager/Withdraw/components/Status.tsx +++ b/src/features/defi/providers/runepool/components/RunePoolManager/Withdraw/components/Status.tsx @@ -98,10 +98,10 @@ export const Status: React.FC = ({ accountId }) => { }, [accountId, appDispatch, contextDispatch, getOpportunitiesUserData, state?.txid]) const handleViewPosition = useCallback(() => { - if (!accountId) return - // The full-page earn dashboard is mobile-only - the account page shows the position on both layouts - navigate(`/accounts/${accountId}`) - }, [accountId, navigate]) + if (!accountId || !assetId) return + // The full-page earn dashboard is mobile-only - the asset account page shows the position on both layouts + navigate(`/accounts/${accountId}/${assetId}`) + }, [accountId, assetId, navigate]) const handleCancel = useCallback(() => { navigate(-1)