From 7f7b605555356e514dea211fe34542886737a01b Mon Sep 17 00:00:00 2001 From: Albert Folch Date: Thu, 20 Jun 2024 16:59:38 +0200 Subject: [PATCH] fix: blank page because the app was crashing, due to having 2 ListUpdaters --- src/CoreComponentsUpdaters.tsx | 51 ------------------- .../header/selector/ChainSelector.tsx | 40 ++++++--------- src/index.tsx | 2 - 3 files changed, 15 insertions(+), 78 deletions(-) delete mode 100644 src/CoreComponentsUpdaters.tsx diff --git a/src/CoreComponentsUpdaters.tsx b/src/CoreComponentsUpdaters.tsx deleted file mode 100644 index bb8ce3b55..000000000 --- a/src/CoreComponentsUpdaters.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - CommitWidgetReduxUpdaters, - ConfigProvider, - hooks -} from "@bosonprotocol/react-kit"; -import { useConfigContext } from "components/config/ConfigContext"; -import { CONFIG } from "lib/config"; -import { - useAccount, - useChainId, - useProvider, - useSigner -} from "lib/utils/hooks/connection/connection"; -import React from "react"; - -export const CoreComponentsUpdaters: React.FC = () => { - const provider = useProvider(); - const isWindowVisible = hooks.useIsWindowVisible(); - const { config } = useConfigContext(); - const connectedChainId = useChainId(); - const { account } = useAccount(); - const signer = useSigner(); - return ( - - - - ); -}; diff --git a/src/components/header/selector/ChainSelector.tsx b/src/components/header/selector/ChainSelector.tsx index dfaf1292d..0932a8436 100644 --- a/src/components/header/selector/ChainSelector.tsx +++ b/src/components/header/selector/ChainSelector.tsx @@ -17,7 +17,6 @@ import { WalletConnectV2 } from "../../../lib/connection/WalletConnectV2"; import { getChainInfo } from "../../../lib/constants/chainInfo"; import { getChainPriority, - TESTNET_CHAIN_IDS, UniWalletSupportedChains } from "../../../lib/constants/chains"; import { getSupportedChainIdsFromWalletConnectSession } from "../../../lib/utils/getSupportedChainIdsFromWalletConnectSession"; @@ -85,30 +84,21 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => { const walletSupportsChain = useWalletSupportedChains(); const [supportedConfigs, unsupportedChains] = useMemo(() => { - const { supported, unsupported } = NETWORK_SELECTOR_CHAINS.filter( - (config) => { - return ( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - TESTNET_CHAIN_IDS.includes(config.chainId as any) - ); - } - ) - .sort( - ({ chainId: a }, { chainId: b }) => - getChainPriority(a as ChainId) - getChainPriority(b as ChainId) - ) - .reduce( - (acc, config) => { - const { chainId: chain } = config; - if (walletSupportsChain.includes(chain as ChainId)) { - acc.supported.push(config); - } else { - acc.unsupported.push(config); - } - return acc; - }, - { supported: [], unsupported: [] } as Record - ); + const { supported, unsupported } = NETWORK_SELECTOR_CHAINS.sort( + ({ chainId: a }, { chainId: b }) => + getChainPriority(a as ChainId) - getChainPriority(b as ChainId) + ).reduce( + (acc, config) => { + const { chainId: chain } = config; + if (walletSupportsChain.includes(chain as ChainId)) { + acc.supported.push(config); + } else { + acc.unsupported.push(config); + } + return acc; + }, + { supported: [], unsupported: [] } as Record + ); return [supported, unsupported]; }, [walletSupportsChain]); diff --git a/src/index.tsx b/src/index.tsx index 25b4ded53..bf6168b4b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,6 @@ import { CommitWidgetReduxProvider } from "@bosonprotocol/react-kit"; import { ConfigProvider } from "components/config/ConfigProvider"; import { CoreSDKProvider } from "components/core-sdk/CoreSDKProvider"; import { FiatLinkProvider } from "components/header/accountDrawer/fiatOnrampModal/FiatLink"; -import { CoreComponentsUpdaters } from "CoreComponentsUpdaters"; import { apolloClient } from "graphql/data/apollo"; import { MulticallUpdater } from "lib/state/multicall"; import { BlockNumberProvider } from "lib/utils/hooks/useBlockNumber"; @@ -62,7 +61,6 @@ root.render( -