Skip to content

Commit

Permalink
[2770] Fix a warning in the console when using handle outside a react…
Browse files Browse the repository at this point in the history
…flow node

Bug: #2770
Signed-off-by: Florian ROUËNÉ <[email protected]>
  • Loading branch information
frouene committed Oct 17, 2024
1 parent 75f2a22 commit 4c102e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface NodeData extends Record<string, unknown> {
isDropNodeTarget: boolean;
isDropNodeCandidate: boolean;
isHovered: boolean;
isFake?: boolean;
}

export enum BorderNodePosition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const prepareLayoutArea = (
const element = createElement(FreeFormNode, {
...freeFormNodeProps,
id: node.id,
data: node.data,
data: { ...node.data, isFake: true },
key: `${node.id}-${index}`,
});
children.push(element);
Expand All @@ -147,7 +147,7 @@ export const prepareLayoutArea = (
...emptyNodeProps,
type: 'listNode',
id: node.id,
data: node.data,
data: { ...node.data, isFake: true },
};

const element = createElement(ListNode, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ export const FreeFormNode: NodeComponentsMap['freeFormNode'] = memo(
/>
) : null}
{selected ? <ConnectionCreationHandles nodeId={id} /> : null}
<ConnectionTargetHandle nodeId={id} nodeDescription={data.nodeDescription} isHovered={data.isHovered} />
<ConnectionHandles connectionHandles={data.connectionHandles} />
{!data.isFake && (
<ConnectionTargetHandle nodeId={id} nodeDescription={data.nodeDescription} isHovered={data.isHovered} />
)}
{!data.isFake && <ConnectionHandles connectionHandles={data.connectionHandles} />}
</div>
{data.outsideLabels.BOTTOM_MIDDLE && (
<Label diagramElementId={id} label={data.outsideLabels.BOTTOM_MIDDLE} faded={data.faded} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ export const ListNode: NodeComponentsMap['listNode'] = memo(
/>
) : null}
{selected ? <ConnectionCreationHandles nodeId={id} /> : null}
<ConnectionTargetHandle nodeId={id} nodeDescription={data.nodeDescription} isHovered={data.isHovered} />
<ConnectionHandles connectionHandles={data.connectionHandles} />
{!data.isFake && (
<ConnectionTargetHandle nodeId={id} nodeDescription={data.nodeDescription} isHovered={data.isHovered} />
)}
{!data.isFake && <ConnectionHandles connectionHandles={data.connectionHandles} />}
</div>
</>
);
Expand Down

0 comments on commit 4c102e9

Please sign in to comment.