Skip to content

Commit

Permalink
Update useHatsTree hook to accept safeAddress parameter and adjust re…
Browse files Browse the repository at this point in the history
…setStore conditional to just reset store when safeAddress changes
  • Loading branch information
Da-Colon committed Dec 11, 2024
1 parent d1f5bb0 commit 5adc033
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/hooks/DAO/loaders/useHatsTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getValue, setValue } from '../../utils/cache/useLocalStorage';

const hatsSubgraphClient = new HatsSubgraphClient({});

const useHatsTree = () => {
const useHatsTree = ({ safeAddress }: { safeAddress: Address | undefined }) => {
const { t } = useTranslation('roles');
const {
governanceContracts: {
Expand Down Expand Up @@ -293,10 +293,10 @@ const useHatsTree = () => {
}, [hatsTree, updateRolesWithStreams, getPaymentStreams, streamsFetched]);

useEffect(() => {
if (!hatsTreeId && !!hatsTree) {
if (safeAddress === undefined) {
resetHatsStore();
}
}, [resetHatsStore, hatsTree, hatsTreeId]);
}, [resetHatsStore, safeAddress]);
};

export { useHatsTree };
2 changes: 1 addition & 1 deletion src/pages/dao/SafeController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function SafeController() {
useAzoriusListeners();

useKeyValuePairs();
useHatsTree();
useHatsTree({ safeAddress });

// the order of the if blocks of these next three error states matters
if (invalidQuery) {
Expand Down

0 comments on commit 5adc033

Please sign in to comment.