mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 07:31:07 +01:00
Filter suggestions to ensure only known types are shown
This commit is contained in:
@@ -6543,6 +6543,18 @@ RED.view = (function() {
|
||||
if (!Array.isArray(suggestion.nodes[0])) {
|
||||
suggestion.nodes = [suggestion.nodes]
|
||||
}
|
||||
// Validate the suggestions only contain node types we recognise - filter out any we don't
|
||||
suggestion.nodes = suggestion.nodes.filter(suggestedNodes => {
|
||||
if (!Array.isArray(suggestedNodes)) {
|
||||
suggestedNodes = [suggestedNodes]
|
||||
}
|
||||
suggestedNodes = suggestedNodes.filter(n => {
|
||||
const def = RED.nodes.getType(n.type)
|
||||
return !!def
|
||||
})
|
||||
return suggestedNodes.length > 0
|
||||
})
|
||||
|
||||
suggestion.count = suggestion.nodes.length
|
||||
suggestion.currentIndex = 0
|
||||
suggestion.current = suggestion.nodes[suggestion.currentIndex]
|
||||
|
||||
Reference in New Issue
Block a user