From 5b6f37f5d62d2fcc11166f2d5f33ee77890e9a49 Mon Sep 17 00:00:00 2001
From: albertfolch-redeemeum
<102516373+albertfolch-redeemeum@users.noreply.github.com>
Date: Thu, 20 Jun 2024 17:00:09 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20blank=20page=20because=20the=20app=20was?=
=?UTF-8?q?=20crashing,=20due=20to=20having=202=20ListUpd=E2=80=A6=20(#109?=
=?UTF-8?q?6)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
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(
-