Skip to content

Commit

Permalink
prepare previousModel before preConditions to prevent mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
nanov committed Jan 24, 2019
1 parent 79f80ae commit 0156a65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/definitions/aggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,13 +738,13 @@ _.extend(Aggregate.prototype, {
throw new Error('You are not allowed to set a value in this step!');
};

var previousModel = new AggregateModel(aggregateModel.id, aggregateModel);

this.checkPreConditions(cmd, aggregateModel, function (err) {
if (err) {
return callback(err);
}

var previousModel = new AggregateModel(aggregateModel.id, aggregateModel);

// attach apply function
aggregateModel.apply = applyHelper(self, aggregateModel, cmd);

Expand Down

0 comments on commit 0156a65

Please sign in to comment.