Currently 99% of All Backbone.js Apps Are Broken
Race conditions in async requests can corrupt Backbone collections. backbone-safesync fixes this by aborting stale requests.
Javascript and Backbone.js is an async world. This also means requests are async. If you’re fetching results for a collection and blindly expecting your collection to match those results, showing them to a user, you’re gonna have a bad time.
Currently slow requests can cause havoc on the state of your collections and models. Imagine this. A user searches for ‘javascript’ first and then ‘dom’. The ‘javascript’ search hangs so the user never gets to see the results. They then search for ‘dom’ and that response comes in right away while the ‘javascript’ search is still pending. The user is presented with books on ‘dom’. The old ‘javascript’ request now responds. The collection and the user’s UI is abruptly changed to books on ‘javascript’. Not good!
backbone-safesync tries to remedy this by aborting old requests.
Thanks to rpflo in #documentcloud for bringing this to light.