Skip to content

Commit

Permalink
add loader when automatic fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
pvicensSpacedev committed Apr 25, 2024
1 parent 58ad5c3 commit 29e077d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/web/src/components/NftSelector/NftSelectorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
NftSelectorCollectionGroup,
} from './groupNftSelectorCollectionsByAddress';
import { NftSelectorContractType } from './NftSelector';
import { NftSelectorLoadingView } from './NftSelectorLoadingView';
import { NftSelectorTokenPreview } from './NftSelectorTokenPreview';

type Props = {
Expand Down Expand Up @@ -109,6 +110,8 @@ export function NftSelectorView({
tokenRefs: tokens,
});

const { isLocked } = useSyncTokens();

const virtualizedListRef = useRef<List | null>(null);
const viewRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -222,6 +225,10 @@ export function NftSelectorView({
[columnCount, onSelectContract, onSelectToken, rows, selectedContractAddress]
);

if (isLocked) {
return <NftSelectorLoadingView />;
}

if (!rows.length && !hasSearchKeyword) {
return (
<StyledWrapper>
Expand Down

0 comments on commit 29e077d

Please sign in to comment.