@@ -13,7 +13,7 @@ import { useGetFormFieldInitialValues } from 'features/workflowLibrary/hooks/use
1313import { newWorkflowSaved } from 'features/workflowLibrary/store/actions' ;
1414import { useCallback , useRef } from 'react' ;
1515import { useTranslation } from 'react-i18next' ;
16- import { useCreateWorkflowMutation , workflowsApi } from 'services/api/endpoints/workflows' ;
16+ import { useCreateWorkflowMutation , useUpdateOpenedAtMutation , workflowsApi } from 'services/api/endpoints/workflows' ;
1717import type { SetFieldType } from 'type-fest' ;
1818
1919/**
@@ -44,6 +44,7 @@ export const useCreateLibraryWorkflow = (): CreateLibraryWorkflowReturn => {
4444 const { t } = useTranslation ( ) ;
4545 const dispatch = useAppDispatch ( ) ;
4646 const [ createWorkflow , { isLoading, isError } ] = useCreateWorkflowMutation ( ) ;
47+ const [ updateOpenedAt ] = useUpdateOpenedAtMutation ( ) ;
4748 const getFormFieldInitialValues = useGetFormFieldInitialValues ( ) ;
4849
4950 const toast = useToast ( ) ;
@@ -70,7 +71,7 @@ export const useCreateLibraryWorkflow = (): CreateLibraryWorkflowReturn => {
7071 dispatch ( newWorkflowSaved ( { category } ) ) ;
7172 // When a workflow is saved, the form field initial values are updated to the current form field values
7273 dispatch ( formFieldInitialValuesChanged ( { formFieldInitialValues : getFormFieldInitialValues ( ) } ) ) ;
73-
74+ updateOpenedAt ( { workflow_id : id } ) ;
7475 onSuccess && onSuccess ( ) ;
7576 toast . update ( toastRef . current , {
7677 title : t ( 'workflows.workflowSaved' ) ,
@@ -92,7 +93,7 @@ export const useCreateLibraryWorkflow = (): CreateLibraryWorkflowReturn => {
9293 }
9394 }
9495 } ,
95- [ toast , t , createWorkflow , dispatch , getFormFieldInitialValues ]
96+ [ toast , t , createWorkflow , dispatch , getFormFieldInitialValues , updateOpenedAt ]
9697 ) ;
9798 return {
9899 createNewWorkflow,
0 commit comments