fix(ui): store hidden state of edges in workflows

This prevents a minor visual bug where collapsed edges between collapsed nodes didn't display correctly on first load of a workflow.
This commit is contained in:
psychedelicious 2024-05-20 08:41:05 +10:00
parent 5553588147
commit 620ee2875e
2 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,7 @@ const zWorkflowEdgeDefault = zWorkflowEdgeBase.extend({
type: z.literal('default'), type: z.literal('default'),
sourceHandle: z.string().trim().min(1), sourceHandle: z.string().trim().min(1),
targetHandle: z.string().trim().min(1), targetHandle: z.string().trim().min(1),
hidden: z.boolean().optional(),
}); });
const zWorkflowEdgeCollapsed = zWorkflowEdgeBase.extend({ const zWorkflowEdgeCollapsed = zWorkflowEdgeBase.extend({
type: z.literal('collapsed'), type: z.literal('collapsed'),

View File

@ -66,6 +66,7 @@ export const buildWorkflowFast: BuildWorkflowFunction = ({ nodes, edges, workflo
target: edge.target, target: edge.target,
sourceHandle: edge.sourceHandle, sourceHandle: edge.sourceHandle,
targetHandle: edge.targetHandle, targetHandle: edge.targetHandle,
hidden: edge.hidden,
}); });
} else if (edge.type === 'collapsed') { } else if (edge.type === 'collapsed') {
newWorkflow.edges.push({ newWorkflow.edges.push({