@@ -19,7 +19,7 @@ import { toKebabCase } from '@/lib/string/to-kebab-case';
1919import { queryKeys } from '@/react-query/constants' ;
2020import { zodResolver } from '@hookform/resolvers/zod' ;
2121import { useQueryClient } from '@tanstack/react-query' ;
22- import { useNavigate } from '@tanstack/react-router' ;
22+ import { useNavigate , useRouter } from '@tanstack/react-router' ;
2323import { useCallback , useEffect , useMemo , useState } from 'react' ;
2424import { useForm } from 'react-hook-form' ;
2525import { toast } from 'sonner' ;
@@ -55,6 +55,7 @@ export function ClusterForm({
5555 startOffOnBilling,
5656} : ClusterFormProps ) {
5757 const navigate = useNavigate ( ) ;
58+ const router = useRouter ( ) ;
5859
5960 const queryClient = useQueryClient ( ) ;
6061 const { mutate : submitNewClusterData , isPending : isCreatePending } = useCreateNewClusterMutation ( ) ;
@@ -266,6 +267,11 @@ export function ClusterForm({
266267 toastId : string | number ;
267268 } ) => {
268269 void queryClient . invalidateQueries ( { queryKey : [ queryKeys . organization ] , refetchType : 'active' } ) ;
270+ if ( ! creating ) {
271+ void queryClient . invalidateQueries ( { queryKey : [ queryKeys . cluster , clusterId ] , refetchType : 'active' } ) ;
272+ }
273+
274+ void router . invalidate ( ) ;
269275 void navigate ( { to : creating ? '../' : '../../' } ) ;
270276 toast . success ( creating ? 'Cluster Created' : 'Cluster Updated' , {
271277 id : toastId ,
@@ -276,7 +282,7 @@ export function ClusterForm({
276282 : 'The updates are being provisioned now.' ,
277283 duration : 5_000 ,
278284 } ) ;
279- } , [ navigate , queryClient ] ) ;
285+ } , [ clusterId , navigate , queryClient , router ] ) ;
280286
281287 const submitCreateCluster = useCallback ( async ( ) => {
282288 const formData = form . getValues ( ) ;
0 commit comments