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:
@@ -0,0 +1,8 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const WORKFLOW_DIFF_FRAGMENT = gql`
|
||||
fragment WorkflowDiffFragment on WorkflowVersionStepChanges {
|
||||
triggerDiff
|
||||
stepsDiff
|
||||
}
|
||||
`;
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
import { WORKFLOW_DIFF_FRAGMENT } from '@/workflow/graphql/fragments/workflowDiffFragment';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const CREATE_WORKFLOW_VERSION_EDGE = gql`
|
||||
mutation CreateWorkflowVersionEdge($input: CreateWorkflowVersionEdgeInput!) {
|
||||
createWorkflowVersionEdge(input: $input) {
|
||||
triggerNextStepIds
|
||||
stepsNextStepIds
|
||||
...WorkflowDiffFragment
|
||||
}
|
||||
}
|
||||
|
||||
${WORKFLOW_DIFF_FRAGMENT}
|
||||
`;
|
||||
|
||||
+4
-14
@@ -1,22 +1,12 @@
|
||||
import { WORKFLOW_DIFF_FRAGMENT } from '@/workflow/graphql/fragments/workflowDiffFragment';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const CREATE_WORKFLOW_VERSION_STEP = gql`
|
||||
mutation CreateWorkflowVersionStep($input: CreateWorkflowVersionStepInput!) {
|
||||
createWorkflowVersionStep(input: $input) {
|
||||
triggerNextStepIds
|
||||
stepsNextStepIds
|
||||
createdStep {
|
||||
id
|
||||
name
|
||||
type
|
||||
settings
|
||||
valid
|
||||
nextStepIds
|
||||
position {
|
||||
x
|
||||
y
|
||||
}
|
||||
}
|
||||
...WorkflowDiffFragment
|
||||
}
|
||||
}
|
||||
|
||||
${WORKFLOW_DIFF_FRAGMENT}
|
||||
`;
|
||||
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
import { WORKFLOW_DIFF_FRAGMENT } from '@/workflow/graphql/fragments/workflowDiffFragment';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DELETE_WORKFLOW_VERSION_EDGE = gql`
|
||||
mutation DeleteWorkflowVersionEdge($input: CreateWorkflowVersionEdgeInput!) {
|
||||
deleteWorkflowVersionEdge(input: $input) {
|
||||
triggerNextStepIds
|
||||
stepsNextStepIds
|
||||
...WorkflowDiffFragment
|
||||
}
|
||||
}
|
||||
|
||||
${WORKFLOW_DIFF_FRAGMENT}
|
||||
`;
|
||||
|
||||
+4
-3
@@ -1,11 +1,12 @@
|
||||
import { WORKFLOW_DIFF_FRAGMENT } from '@/workflow/graphql/fragments/workflowDiffFragment';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DELETE_WORKFLOW_VERSION_STEP = gql`
|
||||
mutation DeleteWorkflowVersionStep($input: DeleteWorkflowVersionStepInput!) {
|
||||
deleteWorkflowVersionStep(input: $input) {
|
||||
triggerNextStepIds
|
||||
stepsNextStepIds
|
||||
deletedStepIds
|
||||
...WorkflowDiffFragment
|
||||
}
|
||||
}
|
||||
|
||||
${WORKFLOW_DIFF_FRAGMENT}
|
||||
`;
|
||||
|
||||
+4
-14
@@ -1,3 +1,4 @@
|
||||
import { WORKFLOW_DIFF_FRAGMENT } from '@/workflow/graphql/fragments/workflowDiffFragment';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const DUPLICATE_WORKFLOW_VERSION_STEP = gql`
|
||||
@@ -5,20 +6,9 @@ export const DUPLICATE_WORKFLOW_VERSION_STEP = gql`
|
||||
$input: DuplicateWorkflowVersionStepInput!
|
||||
) {
|
||||
duplicateWorkflowVersionStep(input: $input) {
|
||||
triggerNextStepIds
|
||||
stepsNextStepIds
|
||||
createdStep {
|
||||
id
|
||||
name
|
||||
type
|
||||
settings
|
||||
valid
|
||||
nextStepIds
|
||||
position {
|
||||
x
|
||||
y
|
||||
}
|
||||
}
|
||||
...WorkflowDiffFragment
|
||||
}
|
||||
}
|
||||
|
||||
${WORKFLOW_DIFF_FRAGMENT}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user