965 flow control arrow menu 1/3 add insert step button (#12519)

Add insert step button to workflow edges



https://github.com/user-attachments/assets/7144f722-f1c7-450f-a8eb-c902071986a1



Also fixes `iconButtonGroup` UI component

## Before


https://github.com/user-attachments/assets/7b5f0245-d0e8-48af-9aa5-a29388a1caea


## After



https://github.com/user-attachments/assets/1820874f-aa99-41ae-8254-c76c275ee3ae
This commit is contained in:
martmull
2025-06-12 14:14:21 +02:00
committed by GitHub
parent a189f15313
commit cf01faf276
31 changed files with 755 additions and 291 deletions

View File

@ -35,7 +35,9 @@ export const useDeleteWorkflowVersionStep = () => {
input: DeleteWorkflowVersionStepInput,
) => {
const result = await mutate({ variables: { input } });
const deletedStep = result?.data?.deleteWorkflowVersionStep;
if (!isDefined(deletedStep)) {
return;
}
@ -43,6 +45,7 @@ export const useDeleteWorkflowVersionStep = () => {
const cachedRecord = getRecordFromCache<WorkflowVersion>(
input.workflowVersionId,
);
if (!isDefined(cachedRecord)) {
return;
}
@ -51,12 +54,21 @@ export const useDeleteWorkflowVersionStep = () => {
...cachedRecord,
steps: (cachedRecord.steps || [])
.filter((step: WorkflowAction) => step.id !== deletedStep.id)
.map((step) => {
.map((step: WorkflowAction) => {
if (!step.nextStepIds?.includes(deletedStep.id)) {
return step;
}
return {
...step,
nextStepIds: step.nextStepIds?.filter(
(nextStepId) => nextStepId !== deletedStep.id,
),
nextStepIds: [
...new Set([
...(step.nextStepIds?.filter(
(nextStepId) => nextStepId !== deletedStep.id,
) || []),
...(deletedStep.nextStepIds || []),
]),
],
};
}),
};
@ -64,6 +76,7 @@ export const useDeleteWorkflowVersionStep = () => {
const recordGqlFields = {
steps: true,
};
updateRecordFromCache({
objectMetadataItems,
objectMetadataItem,