Skip to content

Commit 56746ac

Browse files
committed
feat: enhance Earn and ManagePosition components with improved loading states and withdraw action handling
1 parent b622012 commit 56746ac

File tree

6 files changed

+220
-175
lines changed

6 files changed

+220
-175
lines changed

packages/kit/src/views/Earn/hooks/useEarnPortfolio.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@ export const useEarnPortfolio = () => {
313313
}
314314

315315
const requestId = getCurrentRequestId();
316-
setIsLoading(true);
316+
// Only set loading state for full refresh, not for partial refresh
317+
const isPartialRefresh = Boolean(options);
318+
if (!isPartialRefresh) {
319+
setIsLoading(true);
320+
}
317321

318322
const [assets, accounts] = await Promise.all([
319323
backgroundApiProxy.serviceStaking.getAvailableAssetsV2(),
@@ -456,7 +460,10 @@ export const useEarnPortfolio = () => {
456460
}
457461

458462
updateInvestments(finalMap);
459-
setIsLoading(false);
463+
// Only clear loading state for full refresh
464+
if (!isPartialRefresh) {
465+
setIsLoading(false);
466+
}
460467
}
461468
},
462469
// eslint-disable-next-line react-hooks/exhaustive-deps

0 commit comments

Comments
 (0)