Skip to content

Commit

Permalink
fix: same resultVariable and output names filter only output names
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Jan 7, 2025
1 parent 35b67c7 commit 7d79e35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/zeebe/VariableResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export default class ZeebeVariableResolver extends BaseVariableResolver {
}

const namesToFilter = getElementNamesToRemove(moddleElement, inputOutput);

return variables.filter(v => {
const filteredVariables = variables.filter(v=> {

// Keep all variables that are also defined in other elements
if (v.origin.length > 1 || v.origin[0] !== bo) {
Expand All @@ -59,6 +58,12 @@ export default class ZeebeVariableResolver extends BaseVariableResolver {
// Filter all pre-defined variables
return !namesToFilter.includes(v.name);
});

// keep only unique names
const uniqueVariables = new Map();
filteredVariables.forEach(v => uniqueVariables.set(v.name, v));

return Array.from(uniqueVariables.values());
}

/**
Expand Down
7 changes: 6 additions & 1 deletion lib/zeebe/util/feelUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ export function getResultContext(expression, variables = {}) {
* @returns {{ expression: String, unresolved: Array<String> }}}
*/
function getExpressionDetails(variable, origin) {
const expression = getScriptExpression(variable, origin) || getIoExpression(variable, origin);

// if variable scope is parent scope, first check IoExpression and then ScriptExpression
// if variable is local scope (origin), first check ScriptExpression and then IoExpression
const expression = variable.scope !== origin
? getIoExpression(variable, origin) || getScriptExpression(variable, origin)
: getScriptExpression(variable, origin) || getIoExpression(variable, origin);

if (!expression) {
return;
Expand Down

0 comments on commit 7d79e35

Please sign in to comment.