Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot-fix navigating to subDAO from hierarchy page when parent DAO has large amount of subDAOs #2078

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"js-big-decimal": "^1.3.12",
"lodash.camelcase": "^4.3.0",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"moralis": "^2.26.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down Expand Up @@ -94,6 +95,7 @@
"@testing-library/react": "^14.2.1",
"@types/lodash.camelcase": "^4.3.9",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.isequal": "^4.5.8",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^6.19.0",
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/utils/useCanUserSubmitProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export function useCanUserCreateProposal() {
);
useEffect(() => {
const loadCanUserCreateProposal = async () => {
setCanUserCreateProposal(await getCanUserCreateProposal());
const newCanCreateProposal = await getCanUserCreateProposal();
if (newCanCreateProposal !== canUserCreateProposal) {
setCanUserCreateProposal(newCanCreateProposal);
}
};
loadCanUserCreateProposal();
}, [getCanUserCreateProposal, canUserCreateProposal]);
Expand Down
10 changes: 7 additions & 3 deletions src/providers/App/useReadOnlyValues.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ERC721__factory } from '@fractal-framework/fractal-contracts';
import * as Sentry from '@sentry/react';
import isEqual from 'lodash.isequal';
import { useEffect, useState, useCallback } from 'react';
import { getAddress } from 'viem';
import useSignerOrProvider from '../../hooks/utils/useSignerOrProvider';
Expand Down Expand Up @@ -61,7 +62,7 @@ export const useReadOnlyValues = ({ node, governance }: Fractal, _account?: stri
const address = _account ? getAddress(_account) : undefined;
Sentry.setUser(address ? { id: address } : null);

setReadOnlyValues({
const newReadOnlyValues = {
user: {
address,
votingWeight: await getVotingWeight(),
Expand All @@ -73,8 +74,11 @@ export const useReadOnlyValues = ({ node, governance }: Fractal, _account?: stri
governance.type === GovernanceType.AZORIUS_ERC20 ||
governance.type === GovernanceType.AZORIUS_ERC721,
},
});
}, [node, governance, _account, signerOrProvider]);
};
if (!isEqual(newReadOnlyValues, readOnlyValues)) {
setReadOnlyValues(newReadOnlyValues);
}
}, [node, governance, _account, signerOrProvider, readOnlyValues]);
useEffect(() => {
loadReadOnlyValues();
}, [loadReadOnlyValues]);
Expand Down