Skip to content

Commit

Permalink
Fix network button
Browse files Browse the repository at this point in the history
  • Loading branch information
serg-plusplus committed Sep 21, 2024
1 parent 0b1973a commit 4b65693
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app/components/blocks/NetworksButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const NetworksModal: FC<
const { confirm, alert } = useDialog();

const [searchValue, setSearchValue] = useState("");
const [contentMounted, setContentMounted] = useState(false);

const balancesMap = useMemo(
() =>
Expand Down Expand Up @@ -238,6 +239,7 @@ const NetworksModal: FC<
}, [searchValue, testnetsVisibility]);

const rowVirtualizer = useVirtualizer({
enabled: contentMounted,
count: filteredNetworkList.length,
getScrollElement: () => scrollAreaRef.current,
estimateSize: () => {
Expand Down Expand Up @@ -307,6 +309,8 @@ const NetworksModal: FC<

<Command.List>
<Command.Group className="relative">
<Mount onMountChange={(m) => setContentMounted(m)} />

<ScrollAreaContainer
ref={scrollAreaRef}
className="w-full h-full box-content -mr-5 pr-5 grow"
Expand Down Expand Up @@ -485,3 +489,15 @@ function compareByInstalledNetworks(

return 0;
}

const Mount: FC<{ onMountChange: (mounted: boolean) => void }> = ({
onMountChange,
}) => {
useEffect(() => {
onMountChange(true);
return () => onMountChange(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return null;
};

0 comments on commit 4b65693

Please sign in to comment.