ibm-js / dworklight

Dojo - Worklight Libraries
Other
5 stars 2 forks source link

Store/JSON.js doesn't behave correctly when it can't find data #12

Open andrewferrier opened 10 years ago

andrewferrier commented 10 years ago

I've been using JSON.js as the backing store of a dojo/store/Cache store. However, the Cache (and I think the Dojo store spec. more generally) expects get to return undefined if there is no data (this is an important case, as obviously the cache uses that to decide when it fetches data from the master store). However, JSON.js instead rejects the Deferred. That doesn't make sense to Cache, and causes it never to attempt getting data from the master store - obviously bad. I've hacked around this locally by changing the line in _getLocal to def.resolve(undefined) when nothing is found, but there may be a more robust fix.