-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Sometimes you have to use a custom sort function on Lists, being unable to use this function in can-query-logic means that unexpected insertion/removals will happen when using real-time.
// sorter
function sortByName(item1, item2) {
var val1 = item1.name.toLowerCase();
var val2 = item2.name.toLowerCase()
...
}
// adding the symbol to the list
...
list.sort(sortByName);
list[canSymbol.for('can.listQuery')] = { sort: 'name' };When real-time tries to figure where a new (or existing) item should be placed on the lists it calls getIndex which will sometimes not match the position where the instance "should be placed" based on the sortByName comparator logic.
Ideally we should be able to pass sortByName so can-query-logic can determine the position correctly.