Skip to content

Commit

Permalink
Revert "fix: try to fix infinite switch loop"
Browse files Browse the repository at this point in the history
This reverts commit 49440b5.
  • Loading branch information
belopash committed May 17, 2024
1 parent 49440b5 commit 3e6a2e4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/layouts/NetworkLayout/NetworkLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { alpha } from '@mui/system/colorManipulator';
import classnames from 'classnames';
import { Outlet } from 'react-router-dom';
import { useDisconnect, useNetwork, useSwitchNetwork, useWalletClient } from 'wagmi';
import { useDisconnect, useNetwork, useWalletClient } from 'wagmi';

import { Logo } from '@components/Logo';
import { NetworkSwitcher } from '@components/NetworkSwitcher';
Expand Down Expand Up @@ -261,10 +261,9 @@ export const NetworkLayout = ({
const { chain } = useNetwork();
const { disconnect } = useDisconnect();
const { network, switchAndReset } = useSubsquidNetwork();
const { pendingChainId } = useSwitchNetwork();

useEffect(() => {
if (!isConnected || isLoading || pendingChainId) return;
if (!isConnected || isLoading) return;

if (chain?.id === getChainId(network)) return;

Expand All @@ -274,7 +273,7 @@ export const NetworkLayout = ({
}

disconnect();
}, [chain, disconnect, isConnected, network, isLoading, switchAndReset, pendingChainId]);
}, [chain, disconnect, isConnected, network, isLoading, switchAndReset]);

const theme = useTheme();
const narrowLg = useMediaQuery(theme.breakpoints.down('lg'));
Expand Down

0 comments on commit 3e6a2e4

Please sign in to comment.