Fix use as draft redirection (#9284)
When hitting use as draft in workflow version action, redirects to workflow newly created
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
import { SingleRecordActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/SingleRecordActionHook';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { buildShowPageURL } from '@/object-record/record-show/utils/buildShowPageURL';
|
||||
import { OverrideWorkflowDraftConfirmationModal } from '@/workflow/components/OverrideWorkflowDraftConfirmationModal';
|
||||
import { useCreateNewWorkflowVersion } from '@/workflow/hooks/useCreateNewWorkflowVersion';
|
||||
import { useWorkflowVersion } from '@/workflow/hooks/useWorkflowVersion';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { openOverrideWorkflowDraftConfirmationModalState } from '@/workflow/states/openOverrideWorkflowDraftConfirmationModalState';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
|
||||
@ -21,6 +24,8 @@ export const useUseAsDraftWorkflowVersionSingleRecordAction: SingleRecordActionH
|
||||
openOverrideWorkflowDraftConfirmationModalState,
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const workflowStatuses = workflow?.statuses;
|
||||
|
||||
const shouldBeRegistered =
|
||||
@ -44,6 +49,12 @@ export const useUseAsDraftWorkflowVersionSingleRecordAction: SingleRecordActionH
|
||||
trigger: workflowVersion.trigger,
|
||||
steps: workflowVersion.steps,
|
||||
});
|
||||
navigate(
|
||||
buildShowPageURL(
|
||||
CoreObjectNameSingular.Workflow,
|
||||
workflowVersion.workflow.id,
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user