emberjs/ember.js — pull request #9356 by ef4 (2014-10-18 05:38:04+00:00)
Title: [BUGFIX beta] fixing broken computed.sort semantics

This fixes #9278.

It addresses three separate bad cases, which are each represented by unit tests:

1. When sorting by multiple named properties, we avoid the broken order semantics caused by `SearchProxy`. Note that the bug doesn't just give the wrong sort order -- it can cause duplicate entries, dropped entries, and unhandled exceptions.

2. When sorting by named properties and multiple records change concurrently, we maintain the correctness of our binary search by caching the sort keys we observed for each record when it was inserted.

3. When sorting by a custom comparator, we can't easily cache keys (because the user can theoretically be looking at anything), but we can avoid doing any insertions until all the modified records have been removed.