Skip to content

Commit

Permalink
refactor: Show already loaded positions
Browse files Browse the repository at this point in the history
  • Loading branch information
memoyil committed Jan 3, 2025
1 parent 6651826 commit 47902aa
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions apps/web/src/views/universalFarms/PositionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export const PositionPage = () => {
if (!account) {
return <EmptyListPlaceholder text={t('Please Connect Wallet to view positions.')} />
}
if (v3Loading || v2Loading || stableLoading) {
if (v3Loading && v2Loading && stableLoading) {
return (
<>
<PositionItemSkeleton />
Expand All @@ -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 (
<EmptyListPlaceholder
text={t('You have no %status% position in this wallet.', {
Expand All @@ -435,7 +442,19 @@ export const PositionPage = () => {
[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,
<>
<PositionItemSkeleton />
<Text color="textSubtle" textAlign="center">
<Dots>{t('Loading')}</Dots>
</Text>
</>,
]
}
return elements
}, [
account,
t,
Expand Down

0 comments on commit 47902aa

Please sign in to comment.