Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reduce Dashboard layout shifts #3611

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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