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

[PRD] | [Issue #2529] Organization Hierarchy Cache #2566

Merged
merged 45 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e8d882f
Refactor DaoHierarchyNode and DAONodeInfoCard components for improved…
Da-Colon Nov 22, 2024
7e54387
Add HierarchyDAOInfo cache key and interface for improved caching str…
Da-Colon Nov 22, 2024
7696e74
Implement caching for DAO hierarchy nodes to enhance performance and …
Da-Colon Nov 22, 2024
31bb81d
Refactor DaoHierarchyNode to use DaoHierarchyInfo type and update cac…
Da-Colon Nov 22, 2024
d882324
Merge branch 'develop' into issue/2529-cache-it
Da-Colon Nov 22, 2024
ef12621
Refactor DaoHierarchyNode to use transformNode function for improved …
Da-Colon Nov 22, 2024
232a875
Merge branch 'develop' into issue/2529-cache-it
Da-Colon Nov 22, 2024
55a4cd4
add cache version
Da-Colon Nov 23, 2024
5707413
add new DAOInfo typing
Da-Colon Nov 26, 2024
638640e
refactor: update DAOInfo structure and improve type handling in SafeC…
Da-Colon Nov 26, 2024
7fa5c29
refactor: replace nodeHierarchy with subgraphInfo in DAO components a…
Da-Colon Nov 26, 2024
ebe87c1
refactor: remove unused hooks related to Fractal modules and DAO loading
Da-Colon Nov 26, 2024
3582df2
refactor: update useFractalNode to use subgraph queries and improve D…
Da-Colon Nov 26, 2024
0ca063c
refactor: rename fractalModules to daoModules and update related refe…
Da-Colon Nov 26, 2024
3c35f84
remove duplicate link component
Da-Colon Nov 26, 2024
e62aecb
refactor: simplify props structure in DAONodeInfoCard component
Da-Colon Nov 26, 2024
1f540b6
refactor: update useDaoInfoStore to utilize subgraphInfo and adjust r…
Da-Colon Nov 27, 2024
bd13066
refactor: remove unused setDecentModules call in useUpdateSafeData hook
Da-Colon Nov 27, 2024
b0ec5db
refactor: enhance useFractalNode to integrate safeAPI and decentModul…
Da-Colon Nov 27, 2024
24fc95a
refactor: update DaoHierarchyNode to improve data loading and error h…
Da-Colon Nov 27, 2024
779f296
remove comment, let it ride for now
Da-Colon Nov 27, 2024
2c0fdd7
Merge branch 'issue/2529-cache-it' into breakout-issue/typing-dao-info
Da-Colon Nov 27, 2024
20eee2d
clean up error UI
Da-Colon Nov 27, 2024
db056a2
refactor: replace Flex with Box in DAONodeInfoCard and improve layout…
Da-Colon Nov 27, 2024
51a2c84
refactor: inline props structure in DAONodeInfoCard component
Da-Colon Nov 27, 2024
aa11d66
feat: add voting strategies to DAO hierarchy and update DAONodeInfoCard
Da-Colon Nov 28, 2024
62fb574
fix: handle null node response in DaoHierarchyNode component
Da-Colon Nov 28, 2024
dd821a1
refactor: update layout of voting strategies in DAONodeInfoCard compo…
Da-Colon Nov 28, 2024
680e8dd
refactor: rename modules to modulesAddresses for clarity in DaoInfoSt…
Da-Colon Nov 28, 2024
588301d
refactor: rename daoModules to modules for consistency across compone…
Da-Colon Nov 28, 2024
4fe6a61
refactor: replace FractalModuleData with DecentModule for improved cl…
Da-Colon Nov 28, 2024
41bfc90
refactor: remove unused lookupModules import from useUpdateSafeData hook
Da-Colon Nov 28, 2024
a5fa7f2
Merge branch 'breakout-issue/typing-dao-info' of github.com:decentdao…
Da-Colon Nov 28, 2024
21f4de6
refactor: replace FractalModuleData with DecentModule in DaoHierarchy…
Da-Colon Nov 28, 2024
77881bf
refactor: rename modules variable to decentModules for improved clari…
Da-Colon Nov 28, 2024
782c53b
Merge branch 'breakout-issue/typing-dao-info' of github.com:decentdao…
Da-Colon Nov 28, 2024
730c57c
refactor: update DAO-related types to handle null values for improved…
Da-Colon Nov 29, 2024
003be47
refactor: update safeAddress handling to ensure null safety across ho…
Da-Colon Nov 29, 2024
ed0f426
refactor: remove null type from parentAddress for improved type safet…
Da-Colon Nov 29, 2024
5a9faf6
Merge branch 'breakout-issue/typing-dao-info' of github.com:decentdao…
Da-Colon Nov 30, 2024
f698f95
Merge pull request #2579 from decentdao/issue/2530-hierarchy-voting-s…
Da-Colon Dec 2, 2024
9b9bb42
Merge pull request #2574 from decentdao/breakout-issue/typing-dao-info
Da-Colon Dec 2, 2024
6a47c16
refactor: filter governanceTypes to remove duplicates in DaoHierarchy…
Da-Colon Dec 2, 2024
7d36a2e
Merge branch 'develop' of github.com:decentdao/decent-interface into …
Da-Colon Dec 2, 2024
67d1c1e
refactor: update daoSnapshotENS to subgraphInfo in ProposalsHome comp…
Da-Colon Dec 2, 2024
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
16 changes: 6 additions & 10 deletions src/components/DaoCreator/formComponents/AzoriusGovernance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,12 @@ function DayStepperInput({
export function AzoriusGovernance(props: ICreationStepProps) {
const { values, setFieldValue, isSubmitting, transactionPending, isSubDAO, mode } = props;

const {
safe,
nodeHierarchy: { parentAddress },
fractalModules,
} = useDaoInfoStore();
const { safe, subgraphInfo, modules } = useDaoInfoStore();

const fractalModule = useMemo(
() => fractalModules.find(_module => _module.moduleType === FractalModuleType.FRACTAL),
[fractalModules],
);
const fractalModule = useMemo(() => {
if (!modules) return null;
return modules.find(_module => _module.moduleType === FractalModuleType.FRACTAL);
}, [modules]);

const [showCustomNonce, setShowCustomNonce] = useState<boolean>();
const { t } = useTranslation(['daoCreate', 'common']);
Expand Down Expand Up @@ -241,7 +237,7 @@ export function AzoriusGovernance(props: ICreationStepProps) {
</Alert>
</Flex>
</StepWrapper>
{!!parentAddress && (
{!!subgraphInfo?.parentAddress && (
<Box
padding="1.5rem"
bg="neutral-2"
Expand Down
27 changes: 19 additions & 8 deletions src/components/DaoCreator/formComponents/EstablishEssentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,38 @@ export function EstablishEssentials(props: ICreationStepProps) {
const { t } = useTranslation(['daoCreate', 'common']);
const { values, setFieldValue, isSubmitting, transactionPending, isSubDAO, errors, mode } = props;

const { daoName, daoSnapshotENS, safe } = useDaoInfoStore();
const { subgraphInfo, safe } = useDaoInfoStore();

const isEdit = mode === DAOCreateMode.EDIT;

const safeAddress = safe?.address;

useEffect(() => {
if (isEdit) {
setFieldValue('essentials.daoName', daoName, false);
if (safeAddress && createAccountSubstring(safeAddress) !== daoName) {
if (isEdit && subgraphInfo) {
setFieldValue('essentials.daoName', subgraphInfo.daoName, false);
if (safeAddress && createAccountSubstring(safeAddress) !== subgraphInfo.daoName) {
// Pre-fill the snapshot URL form field when editing
setFieldValue('essentials.snapshotENS', daoSnapshotENS || '', false);
setFieldValue('essentials.snapshotENS', subgraphInfo.daoSnapshotENS || '', false);
}
}
}, [setFieldValue, mode, daoName, daoSnapshotENS, isEdit, safeAddress]);
}, [
setFieldValue,
mode,
subgraphInfo?.daoName,
subgraphInfo?.daoSnapshotENS,
isEdit,
safeAddress,
subgraphInfo,
]);

const daoNameDisabled =
isEdit && !!daoName && !!safeAddress && createAccountSubstring(safeAddress) !== daoName;
isEdit &&
!!subgraphInfo?.daoName &&
!!safeAddress &&
createAccountSubstring(safeAddress) !== subgraphInfo?.daoName;

// If in governance edit mode and snapshot URL is already set, disable the field
const snapshotENSDisabled = isEdit && !!daoSnapshotENS;
const snapshotENSDisabled = isEdit && !!subgraphInfo?.daoSnapshotENS;

const handleGovernanceChange = (value: string) => {
if (value === GovernanceType.AZORIUS_ERC20) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/DaoDashboard/Activities/ProposalsHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function ProposalsHome() {

const { canUserCreateProposal } = useCanUserCreateProposal();

const { daoSnapshotENS } = useDaoInfoStore();
const { subgraphInfo } = useDaoInfoStore();
const [allOptions, setAllFilterOptions] = useState<FractalProposalState[]>([]);

const { t } = useTranslation(['proposal', 'common']);
Expand Down Expand Up @@ -114,12 +114,12 @@ export function ProposalsHome() {
break;
}

if (daoSnapshotENS) {
if (subgraphInfo?.daoSnapshotENS) {
filterOptions = [...filterOptions, ...FILTERS_SNAPSHOT];
}
setAllFilterOptions(filterOptions);
setFilters(filterOptions);
}, [daoSnapshotENS, guardContracts.freezeGuardContractAddress, type]);
}, [subgraphInfo?.daoSnapshotENS, guardContracts.freezeGuardContractAddress, type]);

const toggleFilter = (filter: FractalProposalState) => {
setFilters(prevState => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/DaoDashboard/Info/ParentLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
* Displays a link to the current DAO's parent, if it has one.
*/
export function ParentLink() {
const { nodeHierarchy } = useDaoInfoStore();
const { subgraphInfo } = useDaoInfoStore();
const { addressPrefix } = useNetworkConfig();
const { t } = useTranslation('breadcrumbs');

if (!nodeHierarchy.parentAddress) {
if (!subgraphInfo?.parentAddress) {
return null;
}

return (
<Link
color="celery-0"
_hover={{ textDecoration: 'none', color: 'celery--6' }}
to={DAO_ROUTES.dao.relative(addressPrefix, nodeHierarchy.parentAddress)}
to={DAO_ROUTES.dao.relative(addressPrefix, subgraphInfo.parentAddress)}
marginBottom="1rem"
as={RouterLink}
width="fit-content"
Expand Down
Loading
Loading