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

Aaron/update-cache #31

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions packages/daobox-use-aragon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.0.5-beta-4] - 2023-04-10

### Changed

- new votes invalidates the votes cache
- paginated queries hold data in cache longer

## [0.0.5-beta-3] - 2023-04-09

### Fixed
Expand Down
6 changes: 1 addition & 5 deletions packages/daobox-use-aragon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daobox/use-aragon",
"version": "0.0.5-beta.3",
"version": "0.0.5-beta.4",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand All @@ -26,12 +26,8 @@
"ethers": "^5.7.2",
"graphql": "^16.6.0",
"graphql-request": "^5.2.0",
"wagmi": "~0.11.7",
"zod": "^3.21.4"
},
"peerDependencies": {
"wagmi": "~0.11.7"
},
"devDependencies": {
"@daobox/tsconfig": "workspace:*",
"@graphql-codegen/cli": "^3.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function useFetchDaoBalances(
sortBy,
}),
enabled: !!client && !!daoAddressOrEns && enabled,
keepPreviousData: true,
...options,
});
}
Expand Down
5 changes: 4 additions & 1 deletion packages/daobox-use-aragon/src/core/useFetchDaos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { useAragon } from "../context";
import { createQueryKey } from "../lib/setQueryKey";
import { QueryConfig } from "../types";

export function useFetchDaos(params: UseFetchDaosParams): UseFetchDaosResults {
export function useFetchDaos(
params: UseFetchDaosParams = {}
): UseFetchDaosResults {
const { baseClient: client } = useAragon();
const {
enabled,
Expand All @@ -26,6 +28,7 @@ export function useFetchDaos(params: UseFetchDaosParams): UseFetchDaosResults {
skip,
}),
enabled: !!client && enabled,
keepPreviousData: true,
...options,
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/daobox-use-aragon/src/core/useFetchTransfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function useFetchTransfers(
direction,
}),
enabled: !!client && !!daoAddressOrEns && enabled,
keepPreviousData: true,
...options,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function useFetchProposals(
skip,
}),
enabled: !!(client && daoAddressOrEns && enabled),
keepPreviousData: true,
...options,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react";
import { useMutation } from "@tanstack/react-query";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import {
CreateMajorityVotingProposalParams,
ProposalCreationSteps,
Expand Down Expand Up @@ -34,6 +34,7 @@ export function useNewProposal({
NewProposalStatus.IDLE
);
const { tokenVotingClient: client } = useAragon();
const queryClient = useQueryClient();

async function createProposalWrapper(
newProposalParams: UseNewProposalParams
Expand Down Expand Up @@ -102,9 +103,10 @@ export function useNewProposal({
failSafeActions,
onProposalTransaction,
}),
onSettled: () =>
queryClient.invalidateQueries({ queryKey: ["proposals"] }),
onError,
onMutate,
onSettled,
onSuccess,
}),
proposalId,
Expand Down