backbone-offline icon indicating copy to clipboard operation
backbone-offline copied to clipboard

Backbone 1.0 and Backbone 0.9.10 compatibility difference

Open rtxanson opened this issue 11 years ago • 0 comments

While trying out Backbone.Offline with Backbone 1.0, I uncovered one of the differences. It's nearing the end of the day here, so I won't try to fix and submit a pull request myself, but I thought I'd at least document what I found.

Between 0.9.10 and 1.0, Backbone reverted the API for Backbone.sync success and error callbacks: https://github.com/jashkenas/backbone/commit/6e646f1ba

This this means that with Backbone 1.0, when you run collection.storage.sync.pull(), you get an error such as:

caught TypeError: Cannot use 'in' operator to search for '0' in success 

The problem here of course, is that response ends up being a string "success", not an array of models as the code expects. Unfortunate, because this adds a level of complexity for trying to support both 0.9.10, and 1.0.

rtxanson avatar Jul 14 '13 23:07 rtxanson