diff --git a/packages/adena-extension/src/App/use-app.ts b/packages/adena-extension/src/App/use-app.ts index f7257596..1472934b 100644 --- a/packages/adena-extension/src/App/use-app.ts +++ b/packages/adena-extension/src/App/use-app.ts @@ -4,6 +4,7 @@ import { useLocation } from 'react-router-dom'; import { useAccountName } from '@hooks/use-account-name'; import { useWalletContext } from '@hooks/use-context'; import { useCurrentAccount } from '@hooks/use-current-account'; +import { useLoadImages } from '@hooks/use-load-images'; import { useNetwork } from '@hooks/use-network'; import useScrollHistory from '@hooks/use-scroll-history'; import { useTokenMetainfo } from '@hooks/use-token-metainfo'; @@ -14,6 +15,7 @@ const useApp = (): void => { const { currentAccount } = useCurrentAccount(); const { currentNetwork, checkNetworkState } = useNetwork(); const { initTokenMetainfos } = useTokenMetainfo(); + const { clear: clearLoadingImages } = useLoadImages(); const { pathname, key } = useLocation(); const { scrollMove } = useScrollHistory(); @@ -34,6 +36,7 @@ const useApp = (): void => { return; } + clearLoadingImages(); initTokenMetainfos(); }, [currentAccount?.id, currentNetwork.networkId]); diff --git a/packages/adena-extension/src/hooks/use-load-images.tsx b/packages/adena-extension/src/hooks/use-load-images.tsx index 4747cac8..7df05f92 100644 --- a/packages/adena-extension/src/hooks/use-load-images.tsx +++ b/packages/adena-extension/src/hooks/use-load-images.tsx @@ -7,6 +7,7 @@ export type UseLoadAccountsReturn = { isLoading: boolean; addLoadingImages: (imageUrls: string[]) => void; completeImageLoading: (imageUrl: string) => void; + clear: () => void; }; export const useLoadImages = (): UseLoadAccountsReturn => { @@ -28,5 +29,10 @@ export const useLoadImages = (): UseLoadAccountsReturn => { setLoadedImageUrls((prev) => [...new Set([...prev, imageUrl])]); }; - return { isLoading, addLoadingImages, completeImageLoading }; + const clear = (): void => { + setLoadingImageUrls([]); + setLoadedImageUrls([]); + }; + + return { isLoading, addLoadingImages, completeImageLoading, clear }; };