Skip to content

breeze.saveQueuing.js calling wrong function from breeze entity manager (1 word change required) #39

@woia

Description

@woia

Line 193 of breeze.saveQueuing.js,

function rememberAddedOriginalValues() {
// added entities normally don't have original values but these will now
var added = entities ?
entities.filter(function (e) { return e.entityAspect.entityState.isAdded(); }) :
self.entityManager.getChanges(null, breeze.EntityState.Added); <<---- line 193
added.forEach(function (entity) {
var props = entity.entityType.dataProperties;
var originalValues = entity.entityAspect.originalValues;
props.forEach(function (dp) {
if (dp.isPartOfKey) { return; }
originalValues[dp.name] = entity.getProperty(dp.name);
});
});
}

You meant to get the entities that are added. However, getChanges() only accept 1 argument. You ended up getting all entities from the entity manager. As a result of that, we won't be able to rejectChanges for any entity which failed to save (as originalValues map already overwritten by the above code).

You should be calling self.entityManager.getEntities(null, breeze.EntityState.Added) instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions