Uncaught Error: Attempted to handle the `loadedData` event while in rootState.loaded.updated.uncommitted state

I use ember-data to retrieve data from the REST API and created an App.Category model. In the "index" state, I get the data as follows:

App.Category.find({type: 1}); 

It works great. However, when I switch to a new state and call:

 App.Category.find({type: 2}); 

However, I get this error:

 Uncaught Error: Attempted to handle event `loadedData` on <App.Category:ember424:1> while in state rootState.loaded.updated.uncommitted. Called with {} 

How to fix it?

+4
source share
1 answer

I recently ran into this problem, the main reason was that I was doing something stupid without presenting the JSON representation of the updated model.

Here is an example of what I got from the rails controller when upgrading:

format.json { head status: :ok }

Here is how I fixed it:

format.json { render json: @thing, status: :ok }

+3
source

All Articles