From dc95f173734c9883cd6e541b5154845dcedc8a03 Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:55:50 -0500 Subject: [PATCH] Refactor DaoHierarchyNode to remove unused chainId and streamline network configuration handling --- src/components/DaoHierarchy/DaoHierarchyNode.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/DaoHierarchy/DaoHierarchyNode.tsx b/src/components/DaoHierarchy/DaoHierarchyNode.tsx index 3d4e079ba..6b041fa22 100644 --- a/src/components/DaoHierarchy/DaoHierarchyNode.tsx +++ b/src/components/DaoHierarchy/DaoHierarchyNode.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Link as RouterLink } from 'react-router-dom'; import { Address, getContract, zeroAddress } from 'viem'; -import { useChainId, usePublicClient } from 'wagmi'; +import { usePublicClient } from 'wagmi'; import { DAOQueryDocument } from '../../../.graphclient'; import { SENTINEL_ADDRESS } from '../../constants/common'; import { DAO_ROUTES } from '../../constants/routes'; @@ -43,8 +43,7 @@ export function DaoHierarchyNode({ const safeApi = useSafeAPI(); const [hierarchyNode, setHierarchyNode] = useState(); const [hasErrorLoading, setErrorLoading] = useState(false); - const { addressPrefix, subgraph } = useNetworkConfigStore(); - const chainId = useChainId(); + const { addressPrefix, subgraph, chain } = useNetworkConfigStore(); const publicClient = usePublicClient(); const { getAddressContractType } = useAddressContractType(); @@ -168,7 +167,7 @@ export function DaoHierarchyNode({ if (safeAddress) { const cachedNode = getValue({ cacheName: CacheKeys.HIERARCHY_DAO_INFO, - chainId, + chainId: chain.id, daoAddress: safeAddress, }); if (cachedNode) { @@ -182,7 +181,7 @@ export function DaoHierarchyNode({ setValue( { cacheName: CacheKeys.HIERARCHY_DAO_INFO, - chainId, + chainId: chain.id, daoAddress: safeAddress, }, _node,