Sbbs
Sbbs

Reputation: 1670

Ember-Data Destroy model without persisting

I'm building a simple search interface where each new search removes previous results and pushes new ones into the store. So before making a new query and pushing new records into store I remove the previous ones using deleteRecord(). However, EmberData won't push new results while there are uncommitted records raising this exception:

Attempted to handle eventpushedDataon <App.SearchResult:ember555:312> while in state root.deleted.uncommitted

The problem is that I simply want to remove the existing results (without persisting the removal of course) and show new results.

Upvotes: 0

Views: 376

Answers (1)

jcbvm
jcbvm

Reputation: 1670

As you mentioned in the comments, you only use them at the frontend, in that case you could use the function unloadRecord to delete the records. This function will immediately remove the record from the store where deleteRecord will only mark it for removal (and will be removed when you save the record to the backend).

See unloadRecord

Upvotes: 2

Related Questions