• 
      

    Fix up and improve RB.ResourceCollection.

    Review Request #5714 — Created April 15, 2014 and submitted — Latest diff uploaded

    Information

    Review Board
    release-2.0.x
    74559d3...

    Reviewers

    RB.ResourceCollection was documenting and supporting the old-style way
    of opting in/out of resetting the collection during fetch. Backbone
    changed how this worked. We now support the modern way, and document it.

    The modern way (Backbone.js 1.1+) is to use reset instead of remove.
    Resetting is also opt-in in Backbone.js 1.1, though we flip that for
    this collection to make it opt-out. We're not currently using
    Backbone.js 1.1, but we want to stay close to this semantics to smooth
    over the upgrade process.

    It's also pretty useful to be able to specify the maximum number of
    items to fetch in each batch. Callers could do this by passing
    extraQueryData['max-results'], but that was less than ideal. There's now
    a maxResults option that can be passed instead.

    There's also fixes for the pagination indicators, hasNext and hasPrev,
    which could appear as undefined depending on the payload.

    Made use of this in some new code I'm working on.

    Saw that I only got the number of results back that I requested when
    using maxResults.

    Saw the collection reset on each fetch, instead of just appending.

    Unit tests pass.