From 47902aa28c00530013cdb04d9606548b9739d829 Mon Sep 17 00:00:00 2001 From: memoyil <2213635+memoyil@users.noreply.github.com> Date: Sun, 22 Dec 2024 23:12:08 +0300 Subject: [PATCH] refactor: Show already loaded positions --- .../src/views/universalFarms/PositionPage.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/apps/web/src/views/universalFarms/PositionPage.tsx b/apps/web/src/views/universalFarms/PositionPage.tsx index fb5ffcc13f33e..66882742caebb 100644 --- a/apps/web/src/views/universalFarms/PositionPage.tsx +++ b/apps/web/src/views/universalFarms/PositionPage.tsx @@ -401,7 +401,7 @@ export const PositionPage = () => { if (!account) { return } - if (v3Loading || v2Loading || stableLoading) { + if (v3Loading && v2Loading && stableLoading) { return ( <> @@ -412,7 +412,14 @@ export const PositionPage = () => { ) } - if (!v3PositionList.length && !v2PositionList.length && !stablePositionList.length) { + if ( + !v3Loading && + !v2Loading && + !stableLoading && + !v3PositionList.length && + !v2PositionList.length && + !stablePositionList.length + ) { return ( { [Protocol.V2]: v2PositionList, [Protocol.STABLE]: stablePositionList, } - return selectedPoolTypes.reduce((acc, type) => acc.concat(sectionMap[type]), []).slice(0, cursorVisible) + const elements = selectedPoolTypes.reduce((acc, type) => acc.concat(sectionMap[type]), []).slice(0, cursorVisible) + if (v3Loading || v2Loading || stableLoading) { + return [ + ...elements, + <> + + + {t('Loading')} + + , + ] + } + return elements }, [ account, t,