From 89839f433bb69b2b436f07b7c277d5925eef2bd1 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 13 Sep 2024 14:35:46 +0100 Subject: [PATCH] Do not include Junction type in quick-add for virtual links --- .../editor-client/src/js/ui/typeSearch.js | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js index 703b57309..216cc3e40 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js @@ -335,13 +335,25 @@ RED.typeSearch = (function() { } } function applyFilter(filter,type,def) { - return !def || !filter || - ( - (!filter.spliceMultiple) && - (!filter.type || type === filter.type) && - (!filter.input || type === 'junction' || def.inputs > 0) && - (!filter.output || type === 'junction' || def.outputs > 0) - ) + if (!filter) { + // No filter; allow everything + return true + } + if (type === 'junction') { + // Only allow Junction is there's no specific type filter + return !filter.type + } + if (filter.type) { + // Handle explicit type filter + return filter.type === type + } + if (!def) { + // No node definition available - allow it + return true + } + // Check if the filter is for input/outputs and apply + return (!filter.input || def.inputs > 0) && + (!filter.output || def.outputs > 0) } function refreshTypeList(opts) { var i;