Skip to content

Commit

Permalink
fix: latest io mapping overwrite when duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Jan 11, 2025
1 parent 7675d96 commit fd86b60
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/zeebe/util/feelUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function getIoExpression(variable, origin) {
return;
}

const mapping = mappings.find(mapping => mapping.target === variable.name);
const mapping = mappings.slice().reverse().find(mapping => mapping.target === variable.name);

if (!mapping || !mapping.source) {
return;
Expand Down
19 changes: 19 additions & 0 deletions test/spec/zeebe/Mappings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,25 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
]);
}));


it('should only resolve the latest variable if same name input/output exists', inject(async function(variableResolver, elementRegistry) {

// given
const root = elementRegistry.get('Activity_7');

// when
const variables = await variableResolver.getVariablesForElement(root.businessObject);

// then
expect(variables).to.variableEqual([
{
name: 'foo',
type: 'Number',
info: '123',
}
]);
}));

});


Expand Down

0 comments on commit fd86b60

Please sign in to comment.