Skip to content

Commit 2925f26

Browse files
katarina-calakresimir-coko
authored andcommitted
1652-PR fixes
1 parent 52756e4 commit 2925f26

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

client/src/pages/platform/cluster-element-editor/utils/createClusterElementsNodes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ export default function createClusterElementNodes({
4343
}
4444

4545
const actionTypes = clusterRootComponentDefinition.actionClusterElementTypes;
46+
4647
if (!actionTypes || Object.keys(actionTypes).length === 0) {
4748
return true;
4849
}
4950

5051
const operationElementTypes = actionTypes[operationName];
52+
5153
if (!operationElementTypes || operationElementTypes.length === 0) {
5254
return true;
5355
}

client/src/pages/platform/workflow-editor/WorkflowEditorLayout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import useRightSidebarStore from '@/pages/platform/workflow-editor/stores/useRig
1414
import useWorkflowEditorStore from '@/pages/platform/workflow-editor/stores/useWorkflowEditorStore';
1515
import {useCopilotStore} from '@/shared/components/copilot/stores/useCopilotStore';
1616
import {XIcon} from 'lucide-react';
17-
import {Suspense, lazy, useEffect} from 'react';
17+
import {Suspense, lazy, useEffect, useMemo} from 'react';
1818
import {twMerge} from 'tailwind-merge';
1919
import {useShallow} from 'zustand/shallow';
2020

@@ -86,7 +86,10 @@ const WorkflowEditorLayout = ({includeComponents, runDisabled, showWorkflowInput
8686

8787
const {invalidateWorkflowQueries, updateWorkflowMutation} = useWorkflowEditor();
8888

89-
const isMainRootClusterElement = currentNode?.clusterRoot && !currentNode.isNestedClusterRoot;
89+
const isMainRootClusterElement = useMemo(
90+
() => currentNode?.clusterRoot && !currentNode?.isNestedClusterRoot,
91+
[currentNode?.clusterRoot, currentNode?.isNestedClusterRoot]
92+
);
9093

9194
useEffect(() => {
9295
if (isMainRootClusterElement) {

client/src/pages/platform/workflow-editor/components/WorkflowNodeDetailsPanel.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,10 @@ const WorkflowNodeDetailsPanel = ({
497497

498498
const filteredClusterElementOperations = useMemo(() => {
499499
if (currentComponentDefinition?.clusterElement && currentNode?.clusterElementType) {
500-
return currentComponentDefinition?.clusterElements?.filter((clusterElement) => {
501-
return clusterElement.type === convertNameToSnakeCase(currentNode.clusterElementType as string);
502-
});
500+
return currentComponentDefinition?.clusterElements?.filter(
501+
(clusterElement) =>
502+
clusterElement.type === convertNameToSnakeCase(currentNode.clusterElementType as string)
503+
);
503504
}
504505

505506
return currentComponentDefinition?.clusterElements;

client/src/pages/platform/workflow-editor/nodes/WorkflowNode.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,27 @@ const WorkflowNode = ({data, id}: {data: NodeDataType; id: string}) => {
111111
clusterElementsCanvasOpen && (!!isMainRootClusterElement || isNestedClusterRoot)
112112
);
113113

114-
const clusterElementTypesCount = useMemo(
115-
() =>
114+
const clusterElementTypesCount = useMemo(() => {
115+
const clusterRootRequirementMet =
116116
clusterElementsCanvasOpen &&
117117
(isMainRootClusterElement || isNestedClusterRoot) &&
118-
rootClusterElementDefinition
119-
? getClusterElementTypesCount({
120-
clusterRootComponentDefinition: rootClusterElementDefinition,
121-
operationName: data.operationName,
122-
})
123-
: 0,
124-
[
125-
clusterElementsCanvasOpen,
126-
isNestedClusterRoot,
127-
isMainRootClusterElement,
128-
rootClusterElementDefinition,
129-
data.operationName,
130-
]
131-
);
118+
rootClusterElementDefinition;
119+
120+
if (!clusterRootRequirementMet) {
121+
return 0;
122+
}
123+
124+
return getClusterElementTypesCount({
125+
clusterRootComponentDefinition: rootClusterElementDefinition,
126+
operationName: data.operationName,
127+
});
128+
}, [
129+
clusterElementsCanvasOpen,
130+
isNestedClusterRoot,
131+
isMainRootClusterElement,
132+
rootClusterElementDefinition,
133+
data.operationName,
134+
]);
132135

133136
const nodeWidth = useMemo(
134137
() =>

0 commit comments

Comments
 (0)