From 40a656c4ba66c0e9567905ea3d36a1a7327e56a9 Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:37:52 -0400 Subject: [PATCH] fix heirarchy loading issue --- src/components/pages/DaoHierarchy/DaoNode.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/pages/DaoHierarchy/DaoNode.tsx b/src/components/pages/DaoHierarchy/DaoNode.tsx index 211cdbfc9b..0712fa8899 100644 --- a/src/components/pages/DaoHierarchy/DaoNode.tsx +++ b/src/components/pages/DaoHierarchy/DaoNode.tsx @@ -1,6 +1,6 @@ import { Box } from '@chakra-ui/react'; import { utils } from 'ethers'; -import { useEffect, useRef, useState } from 'react'; +import { useEffect, useState } from 'react'; import { useLoadDAONode } from '../../../hooks/DAO/loaders/useLoadDAONode'; import { useLoadDAOData } from '../../../hooks/DAO/useDAOData'; import { useFractal } from '../../../providers/App/AppProvider'; @@ -26,7 +26,6 @@ export function DaoNode({ daoAddress?: string; depth: number; }) { - const onMountOnly = useRef(true); const [fractalNode, setNode] = useState(); const { loadDao } = useLoadDAONode(); const { daoData } = useLoadDAOData(fractalNode, parentAddress); @@ -39,7 +38,7 @@ export function DaoNode({ const isCurrentDAO = daoAddress === currentDAOAddress; useEffect(() => { - if (daoAddress && onMountOnly.current) { + if (daoAddress && !fractalNode) { loadDao(utils.getAddress(daoAddress)).then(_node => { const errorNode = _node as WithError; if (!errorNode.error) { @@ -80,9 +79,8 @@ export function DaoNode({ }); } }); - onMountOnly.current = false; } - }, [loadDao, daoAddress, fractalNode?.nodeHierarchy.childNodes, depth]); + }, [loadDao, daoAddress, fractalNode, depth]); return (