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

Already on GitHub? Sign in to your account

pushRetrieve now updates primaryKey value of record + tests #535

merged 1 commit into from Sep 27, 2011


None yet
2 participants

mauritslamers commented Jun 30, 2011

When pushRetrieve is used to update a record of which the primaryKey value has changed, it does not update the stores cache.
This behaviour can be reproduced as follows:

var sK = store.loadRecord(Model, { firstname: 'me', lastname: 'too', guid: '@433247823'}, '@433247823');
store.pushRetrieve(Model, 1, {firstname: 'me', lastname: 'too', guid: 1}, sK);
store.idFor(sK); // returns @433247823 instead of 1

The included patch solves this behaviour by mimicking the dataSourceDidComplete behaviour in updating the stores primaryKey value cache. A test is included.

@ColinCampbell ColinCampbell pushed a commit that referenced this pull request Sep 27, 2011

Colin Campbell Merge pull request #535 from mauritslamers/empty
pushRetrieve now updates primaryKey value of record + tests

@ColinCampbell ColinCampbell merged commit 21d3543 into sproutcore:master Sep 27, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment