Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
woia opened this issue Dec 18, 2017 · 2 comments

Comments

@woia
Copy link

woia commented Dec 18, 2017

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.

@wardbell
Copy link
Member

Sounds reasonable. PR?

juliancarrivick pushed a commit to juliancarrivick/breeze.js.labs that referenced this issue Jan 18, 2018
Apply fix as suggested by @woia to allow rejecting changes on entities
which failed to save.
juliancarrivick added a commit to juliancarrivick/breeze.js.labs that referenced this issue Jan 18, 2018
Apply fix as suggested by @woia to allow rejecting changes on entities
which failed to save.
@steveschmitt
Copy link
Member

Fixed in breeze-client 2.0.1. Please see the Release Notes because the usage has changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants