Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4831

This.store.push(data) inserts duplicate objects into the store cache

$
0
0

@gattra wrote:

this.modelFor('master.feed').get('feedTracks').removeObject(feedTrack);
this.store.findRecord('feed-track', feedTrack.id).then((ft) =>{
  ft.deleteRecord();
});

feedTrack.share().then((response) => {
if (response != null) {
    var normalizedResponse = this.store.normalize('feed-track', response);
    this.store.push(normalizedResponse);
});

The code above works as planned at first. The feedTrack record is removed from the array in the model. And the API returns a new object which is then pushed to the store.

But when the push occurs, the old feedTrack record that I had deleted, gets repopulated back into the association array.

It's as if the delete() call never actually did anything and when the model detects a change, it reloads it.

Is this a bug or am I doing something wrong?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4831

Trending Articles