简体   繁体   中英

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

I'm using ember-data to fetch data from a REST API and have created a model App.Category. In the 'index' state, I fetch data this way:

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

That works fine. However, whenever I transition 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 do I fix this?

I recently hit this problem, the root cause was I was doing something silly like not rendering a JSON representation of the updated model.

Here is an example of what I was rendering from a rails controller on update:

format.json { head status: :ok }

Here is how I fixed it:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM