Skip to content

Commit 89f457c

Browse files
fix(ui): mark workflow as opened when creating a new workflow
1 parent 30ed09a commit 89f457c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

invokeai/frontend/web/src/features/workflowLibrary/hooks/useCreateNewWorkflow.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useGetFormFieldInitialValues } from 'features/workflowLibrary/hooks/use
1313
import { newWorkflowSaved } from 'features/workflowLibrary/store/actions';
1414
import { useCallback, useRef } from 'react';
1515
import { useTranslation } from 'react-i18next';
16-
import { useCreateWorkflowMutation, workflowsApi } from 'services/api/endpoints/workflows';
16+
import { useCreateWorkflowMutation, useUpdateOpenedAtMutation, workflowsApi } from 'services/api/endpoints/workflows';
1717
import 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

Comments
 (0)