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

Saving a record immediately after unloading a record with the same id fails #5125

Closed
kaeufl opened this issue Aug 14, 2017 · 3 comments
Closed

Comments

@kaeufl
Copy link
Contributor

kaeufl commented Aug 14, 2017

Given a record in the store with type 'person' and id 'person-1', the following currently fails with ember data >= 2.13:

store.peekRecord('person', 'person-1').unloadRecord();
store.createRecord('person').save();

If the backend returns a payload that again contains the id 'person-1', the save operation fails with the error:
You cannot update the id index of an InternalModel once set. Attempted to update person-1

We run into this issue in an appplication where we can end up with a record being pushed to the store via a websocket push notification before the HTTP POST request initiated by the save operation has returned. We used to workaround this situation by unloading the record in the adapter's createRecord() hook before returning the payload to the store. This has worked until ember data 2.12. This issue thus currently keeps us from upgrading.

Potentially related issues: #5041, #4972, #5006, #4972

@buschtoens
Copy link
Contributor

buschtoens commented Aug 15, 2017

Just as #4942 this issue is probably caused by #4821. This PR is has given me hours of headaches. 😢

The hack described in #4972 (comment) works for now.

@stefanpenner
Copy link
Member

stefanpenner commented Aug 23, 2017

#5126 is merged, will get a release out soon (aiming for tomorrow)

stefanpenner added a commit that referenced this issue Aug 24, 2017
{Backport release} [BUGFIX release] Failing test for #5125 and attempted fix
stefanpenner added a commit that referenced this issue Aug 24, 2017
{Backport beta} [BUGFIX beta] Failing test for #5125 and attempted fix
@dmtask
Copy link

dmtask commented Aug 29, 2017

@stefanpenner When will the new release be released?

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

4 participants