BlairAllegroTech / js-data-jsonapi

JsonApi Adapter for js-data
MIT License
15 stars 5 forks source link

Match the order of jsDataArray to the order of newResponse.data. #19

Closed gotascii closed 8 years ago

gotascii commented 8 years ago

In karma/phantomjs, the order of additions to the data[dataType] hash is preserved when looping via for (var ... in). In chrome, the order does not appear to be preserved. In a debugger placed on L:586, immediately after data[dataType] is populated, chrome shows the hash entries ordered ascending by their key value (i.e. by id ascending). This commit copies data into the jsDataArray based on the order it was presented in the newResponse.data array. All the existing tests pass. I tried to write an additional test, but this doesn't happen in phantomjs, only in chrome :/ I'm new to testing in JS, so let me know if there's a way I could add coverage to this PR. Thanks!

BlairAllegroTech commented 8 years ago

Fixes #19