fix: Deterministic sorting of search results. (#343)

* Deterministic sorting of search results.

This is important for reliable tests, e.g. if you are snapshotting views
and comparing to reference images.

* fix prettier
release
Xavier Shay 2019-06-30 00:53:46 +10:00 committed by Nolan Lawson
parent a0ce9d8122
commit 956aaa91f3
1 changed files with 5 additions and 1 deletions

View File

@ -181,7 +181,11 @@ export default class NimbleEmojiIndex {
var aScore = scores[a.id],
bScore = scores[b.id]
return aScore - bScore
if (aScore == bScore) {
return a.id.localeCompare(b.id)
} else {
return aScore - bScore
}
})
}