walmartlabs/thorax — pull request #211 by kpdecker (2013-08-15 01:22:36+00:00)
Title: load:end only fired if sync invokes complete callback

Hi!

The way the loading mixins are put together is giving me just a touch of grief when it comes to *non*-remote/AJAX loading of models and collections.

I'm using a data adapter that sometimes opts to load model and collection data out of `localStorage` instead of passing on to `$.ajax` (Zepto in my case). I'm running into some difficulty because `load:start` *always* fires from `setModel` (etc.) but `load:end` will *only* fire if the `options.complete` callback is invoked.

`options.complete` will only get invoked if the sync is a remote one and using `$.ajax` (`options.complete` is an AJAX option for Zepto or jQuery `$.ajax`, which is probably just restating what you already know).

So, a `load:start` fires on all loads (local or remote via `Backbone.sync`) but `load:end` only fires for remote syncs.

This leaves me in permanent `loading` limbo on my local syncs!

Any ideas of a workaround here?