Skip to content

Commit

Permalink
feat: reduce Dashboard layout shifts (#3611)
Browse files Browse the repository at this point in the history
  • Loading branch information
therealemjy authored Dec 12, 2024
1 parent 1477974 commit 125e3df
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-rocks-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@venusprotocol/evm": patch
---

reduce Dashboard layout shifts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type QueryObserverOptions, useQuery } from '@tanstack/react-query';
import { type QueryObserverOptions, keepPreviousData, useQuery } from '@tanstack/react-query';

import { useGetApiPools } from 'clients/api';
import getIsolatedPools, {
Expand Down Expand Up @@ -93,6 +93,7 @@ const useGetIsolatedPools = (input?: TrimmedInput, options?: Options) => {
),

refetchInterval,
placeholderData: keepPreviousData,
...options,
enabled: isQueryEnabled,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type QueryObserverOptions, useQuery } from '@tanstack/react-query';
import { type QueryObserverOptions, keepPreviousData, useQuery } from '@tanstack/react-query';

import getLegacyPool, {
type GetLegacyPoolInput,
Expand Down Expand Up @@ -109,6 +109,7 @@ const useGetLegacyPool = (input?: TrimmedInput, options?: Partial<Options>) => {
}),
),
refetchInterval,
placeholderData: keepPreviousData,
...options,
enabled: isQueryEnabled,
});
Expand Down
7 changes: 2 additions & 5 deletions apps/evm/src/pages/Dashboard/Banner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { store } from './store';
export const Banner: React.FC = () => {
const { accountAddress } = useAccountAddress();

const { data: getPrimeTokenData, isLoading: isGetPrimeTokenLoading } = useGetPrimeToken({
const { data: getPrimeTokenData } = useGetPrimeToken({
accountAddress,
});
const isAccountPrime = !!getPrimeTokenData?.exists;
Expand All @@ -22,10 +22,7 @@ export const Banner: React.FC = () => {

const canShowPrimePromotionalBanner = isPrimeEnabled && storeShouldShowPrimePromotionalBanner;

if (
canShowPrimePromotionalBanner &&
((!isAccountPrime && !isGetPrimeTokenLoading) || !accountAddress)
) {
if (canShowPrimePromotionalBanner && (!isAccountPrime || !accountAddress)) {
return <PrimePromotionalBanner onHide={hidePrimePromotionalBanner} />;
}

Expand Down

0 comments on commit 125e3df

Please sign in to comment.