Skip to content
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

SimpleQuery._createSortQuerier sort comparator function is incorrect #159

Closed
msssk opened this issue Sep 17, 2015 · 0 comments · Fixed by #241
Closed

SimpleQuery._createSortQuerier sort comparator function is incorrect #159

msssk opened this issue Sep 17, 2015 · 0 comments · Fixed by #241
Labels

Comments

@msssk
Copy link
Contributor

msssk commented Sep 17, 2015

https://github.com/SitePen/dstore/blob/v1.1.0/SimpleQuery.js#L172

If sorted is an empty array line 196 will always return 0, indicating that both items were equal, which may not be the case. And is actually not the case in Chrome, because Array#sort does not iterate over items in order. For arrays larger than a certain size (10?) it appears to use a half-interval algorithm, so data that was originally in a certain order will be changed to a different order with dstore's current logic.

@msssk msssk changed the title SimpleQuery._createSortQuerier sort comparator function is incorrect SimpleQuery._createSortQuerier sort comparator function is incorrect Sep 17, 2015
@kitsonk kitsonk added the bug label Sep 18, 2015
msssk added a commit to msssk/dstore that referenced this issue Apr 9, 2020
@msssk msssk closed this as completed in #241 Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants