Skip to content

Commit

Permalink
only show currency after all data being loaded@
Browse files Browse the repository at this point in the history
  • Loading branch information
esteblock committed Aug 20, 2024
1 parent f2c6987 commit 9405ba3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/SearchModal/CurrencySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function CurrencySearch({
const [searchQuery, setSearchQuery] = useState<string>('');
const debouncedQuery = useDebounce(searchQuery, 200);
const isAddressSearch = isAddress(debouncedQuery);
const { token: searchToken, needsWrapping } = useToken(debouncedQuery);
const { token: searchToken, needsWrapping, isLoading: isLoadingToken } = useToken(debouncedQuery);
const { tokensAsMap: allTokens } = useAllTokens();

const [showUserAddedTokenModal, setShowUserAddedTokenModal] = useState<boolean>(false);
Expand Down Expand Up @@ -237,7 +237,7 @@ export function CurrencySearch({
)} */}
</PaddedColumn>
<Separator />
{searchToken && !isLoading ? (
{searchToken && !isLoading && !isLoadingToken ? (
<Column style={{ padding: '20px 0', height: '100%' }}>
<CurrencyRow
currency={searchToken}
Expand Down
5 changes: 1 addition & 4 deletions src/hooks/tokens/useToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const findToken = async (
// decimals,
// icon: logo,
// };
console.log("🚀 ~ token, findToken, classicAssetSearch, formattedAddress:", token, classicAssetSearch, formattedAddress)

if (!token?.name || !token?.code) return undefined;
// Here from token.name we will try to understand if this is a classic asset (even if we got a soroban contracta as address).
Expand Down Expand Up @@ -80,7 +79,6 @@ export function useToken(tokenAddress: string | undefined) {
findToken(tokenAddress, tokensAsMap, sorobanContext),
);

console.log("findToken returned ", data)
const handleTokenRefresh = () => {
mutate((key: any) => revalidateKeysCondition(key), undefined, { revalidate: true });
};
Expand All @@ -96,6 +94,7 @@ export function useToken(tokenAddress: string | undefined) {
const bothLoading = isLoading || isStellarClassicAssetLoading;

const needsWrapping = !data && isStellarClassicAsset;


const needsWrappingOnAddLiquidity = (!data && isStellarClassicAsset) || !name;

Expand All @@ -117,8 +116,6 @@ export function useToken(tokenAddress: string | undefined) {
}
}
}
console.log("🚀 ~ useToken ~ newTokenData:", newTokenData)
console.log("🚀 ~ useToken ~ data:", data)

//if not data and AssetExists return isWrapped: false
return {
Expand Down

0 comments on commit 9405ba3

Please sign in to comment.