diff --git a/client/src/pages/automation/projects/components/project-list/ProjectListItem.tsx b/client/src/pages/automation/projects/components/project-list/ProjectListItem.tsx index 49aac95e845..a2bf0eba649 100644 --- a/client/src/pages/automation/projects/components/project-list/ProjectListItem.tsx +++ b/client/src/pages/automation/projects/components/project-list/ProjectListItem.tsx @@ -202,32 +202,27 @@ const ProjectListItem = ({project, projectGitConfiguration, remainingTags}: Proj pullProjectFromGitMutation.mutate({id: project.id!}); }; - const handleProjectListItemClick = useCallback( - (event: React.MouseEvent) => { - const target = event.target as HTMLElement; - - const interactiveSelectors = [ - '[data-interactive]', - '.dropdown-menu-item', - '[data-radix-dropdown-menu-item]', - '[data-radix-dropdown-menu-trigger]', - '[data-radix-collapsible-trigger]', - ].join(', '); - - if (target.closest(interactiveSelectors)) { - return; - } + const handleProjectListItemClick = useCallback((event: React.MouseEvent) => { + const target = event.target as HTMLElement; + + const interactiveSelectors = [ + '[data-interactive]', + '.dropdown-menu-item', + '[data-radix-dropdown-menu-item]', + '[data-radix-dropdown-menu-trigger]', + '[data-radix-collapsible-trigger]', + ].join(', '); + + if (target.closest(interactiveSelectors)) { + return; + } - if (workflowsCollapsibleTriggerRef.current?.contains(target)) { - return; - } + if (workflowsCollapsibleTriggerRef.current?.contains(target)) { + return; + } - if (project.projectWorkflowIds?.length) { - workflowsCollapsibleTriggerRef.current?.click(); - } - }, - [project.projectWorkflowIds] - ); + workflowsCollapsibleTriggerRef.current?.click(); + }, []); return ( <> diff --git a/client/src/pages/platform/workflow-editor/hooks/useLayout.tsx b/client/src/pages/platform/workflow-editor/hooks/useLayout.tsx index 3f108301b60..6f076bf89d6 100644 --- a/client/src/pages/platform/workflow-editor/hooks/useLayout.tsx +++ b/client/src/pages/platform/workflow-editor/hooks/useLayout.tsx @@ -399,6 +399,10 @@ export default function useLayout({ }); useEffect(() => { + if (!workflow) { + return; + } + let layoutNodes = allNodes; let edges: Edge[] = taskEdges; @@ -429,6 +433,7 @@ export default function useLayout({ })); const lastEdge = edges[edges.length - 1]; + if (lastEdge && lastEdge.target === FINAL_PLACEHOLDER_NODE_ID) { edges.pop(); } @@ -457,7 +462,7 @@ export default function useLayout({ }); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [canvasWidth, tasks, triggers]); + }, [canvasWidth, tasks, triggers, workflow]); useEffect(() => { if (canvasWidth > 0) {