Migrate update step changes to diff (#14663)

This PR should fix optimistic rendering issues on step updates:
- compute a diff for trigger and steps on mutations
- build an util that applies that diff (built a more robust version from
https://github.com/AsyncBanana/micropatch)
- apply diff in cache
This commit is contained in:
Thomas Trompette
2025-09-23 18:41:26 +02:00
committed by GitHub
parent a5c47a60d0
commit 6ea7aea92b
31 changed files with 1545 additions and 518 deletions
@@ -45,4 +45,10 @@ export class CreateWorkflowVersionStepInput {
nullable: true,
})
position?: WorkflowStepPositionInput;
@Field(() => String, {
description: 'Step ID',
nullable: true,
})
id?: string;
}
@@ -1,20 +1,13 @@
import { Field, ObjectType } from '@nestjs/graphql';
import graphqlTypeJson from 'graphql-type-json';
import { WorkflowActionDTO } from 'src/engine/core-modules/workflow/dtos/workflow-step.dto';
import GraphQLJSON from 'graphql-type-json';
import { Difference } from 'microdiff';
@ObjectType('WorkflowVersionStepChanges')
export class WorkflowVersionStepChangesDTO {
@Field(() => [String], { nullable: true })
triggerNextStepIds?: string[];
@Field(() => GraphQLJSON, { nullable: true })
triggerDiff?: Difference[];
@Field(() => graphqlTypeJson, { nullable: true })
stepsNextStepIds?: Record<string, string[] | undefined>;
@Field(() => WorkflowActionDTO, { nullable: true })
createdStep?: WorkflowActionDTO;
@Field(() => [String], { nullable: true })
deletedStepIds?: string[];
@Field(() => GraphQLJSON, { nullable: true })
stepsDiff?: Difference[];
}
@@ -11,7 +11,7 @@ import { DuplicateWorkflowVersionStepInput } from 'src/engine/core-modules/workf
import { SubmitFormStepInput } from 'src/engine/core-modules/workflow/dtos/submit-form-step-input.dto';
import { UpdateWorkflowRunStepInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-run-step-input.dto';
import { UpdateWorkflowVersionStepInput } from 'src/engine/core-modules/workflow/dtos/update-workflow-version-step-input.dto';
import { WorkflowActionDTO } from 'src/engine/core-modules/workflow/dtos/workflow-step.dto';
import { WorkflowActionDTO } from 'src/engine/core-modules/workflow/dtos/workflow-action.dto';
import { WorkflowVersionStepChangesDTO } from 'src/engine/core-modules/workflow/dtos/workflow-version-step-changes.dto';
import { WorkflowVersionStepGraphqlApiExceptionFilter } from 'src/engine/core-modules/workflow/filters/workflow-version-step-graphql-api-exception.filter';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';