Select node by default when pending form action (#11378)

We want the run side panel to be open when the form step is pending



https://github.com/user-attachments/assets/a7a7015e-b0b7-422a-b625-eca8f2614ac1
This commit is contained in:
Thomas Trompette
2025-04-04 15:56:57 +02:00
committed by GitHub
parent 59e8e0633b
commit 6b184cc641
4 changed files with 24 additions and 5 deletions

View File

@ -257,6 +257,7 @@ export const workflowRunSchema = z
__typename: z.literal('WorkflowRun'),
id: z.string(),
workflowVersionId: z.string(),
workflowId: z.string(),
output: workflowRunOutputSchema.nullable(),
context: workflowRunContextSchema.nullable(),
status: workflowRunStatusSchema,

View File

@ -29,11 +29,11 @@ export const WorkflowRunVisualizerEffect = ({
}, [setWorkflowRunId, workflowRunId]);
useEffect(() => {
if (!isDefined(workflowVersion)) {
if (!isDefined(workflowRun)) {
return;
}
setWorkflowId(workflowVersion.workflowId);
}, [setWorkflowId, workflowVersion]);
setWorkflowId(workflowRun.workflowId);
}, [setWorkflowId, workflowRun]);
useEffect(() => {
if (!isDefined(workflowRun?.output)) {

View File

@ -144,6 +144,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 0,
},
"selected": false,
},
{
"data": {
@ -157,6 +158,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 150,
},
"selected": false,
},
{
"data": {
@ -170,6 +172,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 300,
},
"selected": false,
},
],
}
@ -319,6 +322,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 0,
},
"selected": false,
},
{
"data": {
@ -332,6 +336,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 150,
},
"selected": false,
},
{
"data": {
@ -345,6 +350,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 300,
},
"selected": false,
},
],
}
@ -479,6 +485,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 0,
},
"selected": false,
},
{
"data": {
@ -492,6 +499,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 150,
},
"selected": false,
},
{
"data": {
@ -505,6 +513,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 300,
},
"selected": false,
},
],
}
@ -672,6 +681,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 0,
},
"selected": false,
},
{
"data": {
@ -685,6 +695,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 150,
},
"selected": false,
},
{
"data": {
@ -698,6 +709,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 300,
},
"selected": false,
},
{
"data": {
@ -711,6 +723,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0,
"y": 450,
},
"selected": false,
},
],
}

View File

@ -15,8 +15,8 @@ import {
} from '@/workflow/workflow-diagram/types/WorkflowDiagram';
import { getWorkflowDiagramTriggerNode } from '@/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode';
import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId';
import { v4 } from 'uuid';
import { isDefined } from 'twenty-shared/utils';
import { v4 } from 'uuid';
export const generateWorkflowRunDiagram = ({
trigger,
@ -79,11 +79,15 @@ export const generateWorkflowRunDiagram = ({
}
const runResult = stepsOutput?.[nodeId];
const isPendingFormAction =
step.type === 'FORM' &&
isDefined(runResult?.pendingEvent) &&
runResult.pendingEvent;
let runStatus: WorkflowDiagramRunStatus;
if (skippedExecution) {
runStatus = 'not-executed';
} else if (!isDefined(runResult) || isDefined(runResult.pendingEvent)) {
} else if (!isDefined(runResult) || isPendingFormAction) {
runStatus = 'running';
} else {
if (isDefined(runResult.error)) {
@ -105,6 +109,7 @@ export const generateWorkflowRunDiagram = ({
x: xPos,
y: yPos,
},
selected: isPendingFormAction,
});
processNode({