React-table: Sort is not stable

Created on 16 Apr 2018  路  4Comments  路  Source: tannerlinsley/react-table

What version of React-Table are you using?

6.8.0

What bug are you experiencing, or what feature are you proposing?

When I switch the sort order of one column with the same value for each row, then the order becomes reversed. I'd expect the order to stay the same, as per: https://en.wikipedia.org/wiki/Sorting_algorithm#Stability

Use https://codesandbox.io/s/X6npLXPRW (by clicking the "Fork" button) to reproduce the issue.

https://codesandbox.io/s/kmjw832rkr

What are the steps to reproduce the issue?

  1. Click the "Age" column header to sort ascending by age.
  2. Click the "Age" column header to sort descending by age.
  3. Result: The order of rows becomes reversed although the age is the same for each row.

All 4 comments

Closing due to issue age. If you think this issue needs to be reopened or if it should be turned into a pull-request, please check the latest version of React-Table for the issue or feature once more and reopen or create a PR if appropriate. Thanks!

Hi,

I'm using the version 6.8.6 and I have the same problem.
Is there any way to solve this?

Thanks!

This is still an issue in "6.9.2".

still an issue in 7.0.4. can work around by using multicolumn sort instead of depending on stable sort (shift click the columns). Hopefully can find a way to make this default behavior.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

larrybotha picture larrybotha  路  20Comments

agray5 picture agray5  路  39Comments

IPessers picture IPessers  路  20Comments

Nizar-Rahme picture Nizar-Rahme  路  21Comments

visarts picture visarts  路  36Comments