Add simple caching of env var lookup

This commit is contained in:
Nick O'Leary 2024-01-05 21:07:20 +00:00
parent c2710f4f6f
commit 54e6d60fe5
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -110,6 +110,10 @@
}
function getEnvVars (obj, envVars = {}) {
contextKnownKeys.env = contextKnownKeys.env || {}
if (contextKnownKeys.env[obj.id]) {
return contextKnownKeys.env[obj.id]
}
let parent
if (obj.type === 'tab' || obj.type === 'subflow') {
RED.nodes.eachConfig(function (conf) {
@ -130,9 +134,10 @@
envVars[env.name] = obj
})
}
contextKnownKeys.env[obj.id] = envVars
return envVars
}
RED.pp = getEnvVars
const envAutoComplete = function (val) {
const editStack = RED.editor.getEditStack()
if (editStack.length === 0) {