Skip to content

Commit

Permalink
fix heirarchy loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Da-Colon committed Mar 12, 2024
1 parent 45150fa commit 40a656c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/pages/DaoHierarchy/DaoNode.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -26,7 +26,6 @@ export function DaoNode({
daoAddress?: string;
depth: number;
}) {
const onMountOnly = useRef(true);
const [fractalNode, setNode] = useState<FractalNode>();
const { loadDao } = useLoadDAONode();
const { daoData } = useLoadDAOData(fractalNode, parentAddress);
Expand All @@ -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) {
Expand Down Expand Up @@ -80,9 +79,8 @@ export function DaoNode({
});
}
});
onMountOnly.current = false;
}
}, [loadDao, daoAddress, fractalNode?.nodeHierarchy.childNodes, depth]);
}, [loadDao, daoAddress, fractalNode, depth]);

return (
<Box position="relative">
Expand Down

0 comments on commit 40a656c

Please sign in to comment.