mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
resolve params in runJS (#2574)
This commit is contained in:
parent
dd2f6438f4
commit
9f49935466
1 changed files with 10 additions and 1 deletions
|
|
@ -649,7 +649,16 @@ export class DataQueriesService {
|
|||
const variables = resolvedValue.match(/\{\{(.*?)\}\}/g);
|
||||
|
||||
for (const variable of variables || []) {
|
||||
resolvedValue = resolvedValue.replace(variable, options[variable]);
|
||||
let replacement = options[variable];
|
||||
// Check if the replacement is an object
|
||||
if (typeof replacement === 'object' && replacement !== null) {
|
||||
// Ensure parent is a non-empty array before attempting to access its first element
|
||||
if (Array.isArray(parent) && parent.length > 0) {
|
||||
// Assign replacement value based on the first item in the parent array
|
||||
replacement = replacement[parent[0]];
|
||||
}
|
||||
}
|
||||
resolvedValue = resolvedValue.replace(variable, replacement);
|
||||
}
|
||||
if (parent && key !== null) {
|
||||
parent[key] = resolvedValue;
|
||||
|
|
|
|||
Loading…
Reference in a new issue