reddit/reddit-plugin-about — pull request #24 by chromakode (2013-04-22 02:30:07+00:00)
Title: Clean up chunk fetching code and fix on Backbone 1.0.0.

This is kind of gnarly and esoteric. I'd be happy to give a walkthrough of why these changes were necessary and how they fit into the big picture.

Postcard chunk fetching was broken by the "smart" update interface change in
Backbone 1.0.0. In addition, the old way of updating the grid view from
added chunks was too dependent on the ordering of "add" events to work
with the new semantics (specifically, that prior view elements must
exist to insert the current view element into the proper DOM position).

To address this, this change adds a "replace" event which is fired upon
chunk load with the chunk's model and an array of the postcard models
contained within the chunk. The view code then renders all of the
postcard models and replaces the chunk placeholder with them in one
step, thus removing the need for positions of other view elements.

:eyeglasses: @spladug @atiaxi