-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Emberdata store.createRecord() , pushes duplicated records after save() #4421
Comments
I'm able to verify that there are duplicates in this case. Here is a twiddle that highlights the problem. The issue can be mitigated by waiting for the save to complete before finding all: import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.createRecord('dupe', {
"message": "hello world one",
"posted": "2016-06-05T10:11:01.473Z",
"user": "v3ss0n"
}).save().then(() => {
return this.store.findAll('dupe');
});
}
}); Working on figuring out why this happens. |
Thank you @code0100fun. |
thanks a lot for verifying this @code0100fun ! |
I'm experimenting the same issue. I create a new record in a route 'services.new' after I save I transition to the services.index view and I see the record twice. When looking at ember inspector I see the record with an id and without an id. Once I refresh the page then it goes away, so it seems there are two copies in memory. |
I was able to expose this in a test also. Still trying to track down exactly where the problem is. Pretty sure it will be somewhere in If anyone else has experience with |
@diasjorge same behavior. when refreshes it goes away, no more duplicates. |
In my case and this is maybe a different issue. When doing a createRecord operation the server was not responding with the structure expected by the rest adapter, so I fixed it and now the duplicates are gone. |
same here, my issue was that the response to the POST request did not contain the id property. Happens if you respond with the same body you got in the request, although your backend gave the new resource an id. |
anything new on this? |
@v3ss0n this is currently a known limitation of Ember-Data, tracked in #4262. As pointed out by @code0100fun in #4421 (comment) you can work around it by waiting for the response of Another solution is to ensure that |
route
model
POST
response after .save()GET
response for .findAll()Results : duplicated records with same ID.
The text was updated successfully, but these errors were encountered: