From b96f85edeea544ddc7f10ecd735e3966e9593dc3 Mon Sep 17 00:00:00 2001 From: Dima Grossman Date: Mon, 23 Dec 2024 11:31:36 +0200 Subject: [PATCH] fix(dashboard): navigate post sync --- apps/dashboard/src/hooks/use-sync-workflow.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/hooks/use-sync-workflow.tsx b/apps/dashboard/src/hooks/use-sync-workflow.tsx index cf58ffbf456..cce12d5142a 100644 --- a/apps/dashboard/src/hooks/use-sync-workflow.tsx +++ b/apps/dashboard/src/hooks/use-sync-workflow.tsx @@ -11,11 +11,14 @@ import { WorkflowOriginEnum, WorkflowStatusEnum } from '@novu/shared'; import { useMutation } from '@tanstack/react-query'; import { useMemo, useState } from 'react'; import { toast } from 'sonner'; +import { useNavigate } from 'react-router-dom'; +import { buildRoute, ROUTES } from '@/utils/routes'; export function useSyncWorkflow(workflow: WorkflowResponseDto | WorkflowListResponseDto) { const { currentEnvironment, oppositeEnvironment, switchEnvironment } = useEnvironment(); const [isLoading, setIsLoading] = useState(false); const [showConfirmModal, setShowConfirmModal] = useState(false); + const navigate = useNavigate(); let loadingToast: string | number | undefined = undefined; @@ -79,7 +82,10 @@ export function useSyncWorkflow(workflow: WorkflowResponseDto | WorkflowListResp actionLabel={`Switch to ${environment?.name}`} onAction={() => { close(); - switchEnvironment(environment?.slug || ''); + const targetSlug = environment?.slug || ''; + switchEnvironment(targetSlug); + + navigate(buildRoute(ROUTES.WORKFLOWS, { environmentSlug: targetSlug })); }} onClose={close} />