diff --git a/src/hooks/DAO/loaders/useHatsTree.ts b/src/hooks/DAO/loaders/useHatsTree.ts index 0dbe4d0e2..b6b181c97 100644 --- a/src/hooks/DAO/loaders/useHatsTree.ts +++ b/src/hooks/DAO/loaders/useHatsTree.ts @@ -10,27 +10,23 @@ import { SablierV2LockupLinearAbi } from '../../../assets/abi/SablierV2LockupLin import { useFractal } from '../../../providers/App/AppProvider'; import useIPFSClient from '../../../providers/App/hooks/useIPFSClient'; import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider'; -import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore'; import { DecentHatsError } from '../../../store/roles/rolesStoreUtils'; import { useRolesStore } from '../../../store/roles/useRolesStore'; import { SablierPayment } from '../../../types/roles'; import { convertStreamIdToBigInt } from '../../streams/useCreateSablierStream'; import { CacheExpiry, CacheKeys } from '../../utils/cache/cacheDefaults'; import { getValue, setValue } from '../../utils/cache/useLocalStorage'; -import { useParseSafeAddress } from '../useParseSafeAddress'; const hatsSubgraphClient = new HatsSubgraphClient({}); const useHatsTree = () => { const { t } = useTranslation('roles'); - const { safeAddress } = useParseSafeAddress(); const { governanceContracts: { linearVotingErc20WithHatsWhitelistingAddress, linearVotingErc721WithHatsWhitelistingAddress, }, } = useFractal(); - const { safe } = useDaoInfoStore(); const { hatsTreeId, contextChainId, @@ -297,10 +293,10 @@ const useHatsTree = () => { }, [hatsTree, updateRolesWithStreams, getPaymentStreams, streamsFetched]); useEffect(() => { - if (safeAddress && safe?.address && safeAddress !== safe.address && hatsTree) { + if (!hatsTreeId && !!hatsTree) { resetHatsStore(); } - }, [resetHatsStore, safeAddress, safe?.address, hatsTree]); + }, [resetHatsStore, hatsTree, hatsTreeId]); }; export { useHatsTree }; diff --git a/src/hooks/DAO/useKeyValuePairs.ts b/src/hooks/DAO/useKeyValuePairs.ts index 38615ef52..e850e1bf4 100644 --- a/src/hooks/DAO/useKeyValuePairs.ts +++ b/src/hooks/DAO/useKeyValuePairs.ts @@ -1,7 +1,6 @@ import { abis } from '@fractal-framework/fractal-contracts'; import { hatIdToTreeId } from '@hatsprotocol/sdk-v1-core'; import { useEffect } from 'react'; -import { useSearchParams } from 'react-router-dom'; import { Address, GetContractEventsReturnType, getContract } from 'viem'; import { usePublicClient } from 'wagmi'; import { logError } from '../../helpers/errorLogging'; @@ -99,14 +98,11 @@ const useKeyValuePairs = () => { contracts: { keyValuePairs, sablierV2LockupLinear }, } = useNetworkConfig(); const { setHatKeyValuePairData } = useRolesStore(); - const [searchParams] = useSearchParams(); const safeAddress = node.safe?.address; useEffect(() => { - const safeParam = searchParams.get('dao'); - - if (!publicClient || !safeAddress || safeAddress !== safeParam?.split(':')[1]) { + if (!safeAddress || !publicClient) { return; } @@ -160,7 +156,6 @@ const useKeyValuePairs = () => { keyValuePairs, safeAddress, publicClient, - searchParams, setHatKeyValuePairData, sablierV2LockupLinear, ]);