@@ -21,7 +21,7 @@ import {
2121 ToastVisibility ,
2222} from "@spark-design/tokens" ;
2323import { useEffect , useState } from "react" ;
24- import { useParams } from "react-router-dom" ;
24+ import { useNavigate , useParams } from "react-router-dom" ;
2525import { useAppDispatch , useAppSelector } from "../../../store/hooks" ;
2626import {
2727 clearCluster ,
@@ -47,7 +47,8 @@ export interface ClusterEditProps {
4747const ClusterEdit = ( { HostsTableRemote } : ClusterEditProps ) => {
4848 const cy = { "data-cy" : dataCy } ;
4949 const { clusterName } = useParams < urlParams > ( ) as urlParams ;
50- const navigate = useInfraNavigate ( ) ;
50+ const navigate = useNavigate ( ) ;
51+ const infraNavigate = useInfraNavigate ( ) ;
5152 const dispatch = useAppDispatch ( ) ;
5253
5354 //initial nodes
@@ -341,7 +342,7 @@ const ClusterEdit = ({ HostsTableRemote }: ClusterEditProps) => {
341342 variant = { ButtonVariant . Secondary }
342343 onPress = { ( ) => {
343344 dispatch ( clearCluster ( ) ) ;
344- navigate ( clusterManagementRoute ) ;
345+ navigate ( - 1 ) ;
345346 } }
346347 >
347348 Cancel
@@ -387,7 +388,7 @@ const ClusterEdit = ({ HostsTableRemote }: ClusterEditProps) => {
387388 onHide = { ( ) => {
388389 if ( onReqSuccess ( ) ) {
389390 setSuccessVisibility ( ToastVisibility . Hide ) ;
390- navigate ( clusterManagementRoute ) ;
391+ infraNavigate ( clusterManagementRoute ) ;
391392 }
392393 if ( onReqError ( ) ) {
393394 setErrorVisibility ( ToastVisibility . Hide ) ;
0 commit comments