-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ember.computed.sort fails #11252
Comments
Can anyone else confirm this bug? I've created a JSBin of the problem here: |
Hi @jamiechong. Sorry for the ridiculously long response time! I can confirm your report. The problem lies with 'A' < 'Z' // true
'Z' < 'a' // true
'a' < 'z' // true however using Ember.compare('A', 'Z') // -1
Ember.compare('Z', 'a') // 1, should be -1
Ember.compare('a', 'z') // -1 This is because What do you think @stefanpenner / @rwjblue? |
I'm unsure. It definitely seems like a bug to me, and we should probably fix it. We can land a fix on canary and let it live through a full cycle to see if it impacts folks... |
instead of String#localeCompare There are edge cases where String#localeCompare behaves unexpectedly, so, we'll use relational operators instead to compare Strings. Closes emberjs#11252
This is not a bugfix, it is a breaking change to make string compare not use the default locale, many locales use case insensitive compares. A locale compare is not going to work for comparing strings that should use a locale invariant. |
If the fix was invalid, then I believe this issue cannot be fixed in a locale aware way (i.e. we can make it work for ascii/English but not across the board). If that is the case, this issue is basically a CANTFIX, right? |
@rwjblue it is a can't fix, but one could either do an addon or request a locale invariant version of this API. You would need a |
Firebase claims that their unique ids are naturally sorted. However, with a hasMany recordset sorted ascending I get the wrong order.
This is a snippet of my Model
In Firebase I have these table IDs (sorted asc):
The
tablesAsc
computed should give me the same order, but instead it gives me this:Interestingly when using Javascript Sort, nothing changes (as expected):
The text was updated successfully, but these errors were encountered: