emberjs/data — Issue #116: find, findAll, findQuery philosophy
Author: escalant3
Created: 2012-02-23 23:58:30+00:00
State: open

I am playing with my own adapter and I am getting some errors that I do not fully understand. I have explored the code and checked the tests, but I still cannot figure out the way I should proceed.

Let's say I want to retrieve an specific set of data from my server i.e. a customer. I would use:
App.store.find(App.Customer, {name: "John Doe"})
If for some reason I want another one then it also works if I do:
App.store.find(App.Customer, {name: "John Carmack"})
But in the case I do another request that returns a record already in the store like:
App.store.find(App.Customer, {name: "John Doe"})
I get a:
Uncaught Error: could not respond to event setData in state rootState.loaded.saved

However if I try to do exactly the same using the id instead of a query everything works.

This example maybe is too naive, but in my application I have several queries returning a collection of data that I do not know if it is going to cause crashes with data already loaded in the store.

Is this the expected behaviour? If so, which could be an elegant way to solve the problem?

I can try to solve it modifying the code, but if I am not getting something of the way of doing things of ember I would like to know before doing it.

Thanks in advance