Skip to content

Commit

Permalink
add mount check
Browse files Browse the repository at this point in the history
  • Loading branch information
lochie committed Aug 14, 2023
1 parent e2a9d2d commit b0bb2fe
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions packages/connectkit/src/components/Common/Chain/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { AnimatePresence } from 'framer-motion';
import supportedChains from '../../../constants/supportedChains';
import Chains from '../../../assets/chains';
import useIsMounted from '../../../hooks/useIsMounted';

const Spinner = (
<svg
Expand Down Expand Up @@ -54,13 +55,19 @@ const Chain: React.FC<{
unsupported?: boolean;
radius?: number | string;
size?: number | string;
}> = ({
id,
unsupported,
radius = '50%',
size = 24
}) => {
}> = ({ id, unsupported, radius = '50%', size = 24 }) => {
const chain = supportedChains.find((c) => c.id === id);
const isMounted = useIsMounted();
if (!isMounted)
return (
<div
style={{
width: size,
height: size,
}}
/>
);

return (
<ChainContainer size={size} radius={radius}>
<AnimatePresence initial={false}>
Expand Down

0 comments on commit b0bb2fe

Please sign in to comment.