Attempted to handle event `pushedData` on while in state root.deleted.inFlight


I have a basic crud app for blog posts.The above error shows up in the console.After I delete the post.But the post gets deleted from the database.I searched for similar questions and none of the answers solved the issue.I use JSONAPIAdapter for the crud actions.

I checked the ember inspector for the flags and the flag for isDeleted is set to true.FYI the number of records shown in ember data is precise.

  var self = this;
  this.get('store').find('post', id)
    .then(post => post.destroyRecord())
      .then(() => self.transitionToRoute('posts'));

I use nodejs as backend and mysql as db.After deleting the record I send a response like this res.status(204).end();

Ember CLI version 2.6.3

enter image description here

The above details in the image is the response from the server.
enter image description here


I’m pretty sure that this issue is being caused by ember data’s background reload. Even though the find request to the api is triggered before the delete request, the find request is resolving after you’ve triggered the delete request. To disable background reload and force an api call you can pass {reload: true} to the findRecord() call. This will ensure that the find request resolves before you trigger the delete request.

Like this:

deletePost(id) {
  this.get('store').findRecord('post', id, { reload: true }).then((post) => { 
    return post.destroyRecord();
  }).then(() => {

You can read more about findRecord here:

In the future, I’d recommend not using the arrow function shorthand since it will always return even when you don’t want to a return value.

Leave a Reply

Your email address will not be published. Required fields are marked *