Skip to content

Commit c1356f3

Browse files
committed
fix: processes list query wasn't being cleared after creating new processes
1 parent 6bd979c commit c1356f3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/ProcessCreate/Steps/Confirm.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
useDisclosure,
1717
useToast,
1818
} from '@chakra-ui/react'
19+
import { useQueryClient } from '@tanstack/react-query'
1920
import { ElectionProvider, errorToString, useClient } from '@vocdoni/react-providers'
2021
import {
2122
ApprovalElection,
@@ -45,6 +46,7 @@ import { CensusMeta } from '~components/Process/Census/CensusType'
4546
import { StampsUnionTypes } from '~components/ProcessCreate/Census/Gitcoin/StampsUnionType'
4647
import { CensusGitcoinValues } from '~components/ProcessCreate/StepForm/CensusGitcoin'
4748
import { DefaultCensusSize } from '~constants'
49+
import { QueryKeys } from '~src/queries/keys'
4850
import { useCspAdmin } from '../Census/Csp/use-csp'
4951
import Preview from '../Confirm/Preview'
5052
import { CreationProgress, Steps } from '../CreationProgress'
@@ -66,6 +68,7 @@ export const Confirm = () => {
6668
const [created, setCreated] = useState<string | null>(null)
6769
const [step, setStep] = useState<Steps>()
6870
const { vocdoniAdminClient } = useCspAdmin()
71+
const qclient = useQueryClient()
6972

7073
const methods = useForm({
7174
defaultValues: {
@@ -131,6 +134,11 @@ export const Confirm = () => {
131134
duration: 4000,
132135
})
133136

137+
// clear process list cache
138+
qclient.resetQueries({
139+
queryKey: QueryKeys.organization.elections(),
140+
})
141+
134142
// fetch account to update the election index and account balance
135143
await fetchAccount()
136144

0 commit comments

Comments
 (0)