From 0b172be7a5a2eb9d661c3cc4552d6fd012e9ad20 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 26 Jun 2025 10:30:25 +0100 Subject: [PATCH] Don't require x/y when providing single node in suggestion api --- .../@node-red/editor-client/src/js/ui/view.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 35d49e01b..65f947d5f 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -1747,15 +1747,11 @@ RED.view = (function() { suggest: function (suggestion) { if (suggestion?.nodes?.length > 0) { // Reposition the suggestion relative to the existing ghost node position - const deltaX = suggestion.nodes[0].x - point[0] - const deltaY = suggestion.nodes[0].y - point[1] + const deltaX = (suggestion.nodes[0].x || 0) - point[0] + const deltaY = (suggestion.nodes[0].y || 0) - point[1] suggestion.nodes.forEach(node => { - if (Object.hasOwn(node, 'x')) { - node.x = node.x - deltaX - } - if (Object.hasOwn(node, 'y')) { - node.y = node.y - deltaY - } + node.x = (node.x || 0) - deltaX + node.y = (node.y || 0) - deltaY }) } setSuggestedFlow(suggestion);