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

sortUndefined not working as expected #5191

Closed
2 tasks done
yovany-lg opened this issue Dec 6, 2023 · 1 comment
Closed
2 tasks done

sortUndefined not working as expected #5191

yovany-lg opened this issue Dec 6, 2023 · 1 comment

Comments

@yovany-lg
Copy link

yovany-lg commented Dec 6, 2023

Describe the bug

Recently, I made a package upgrade from 8.5.13 to 8.10.7, and now, sorting undefined values doesn't work as usual. My dataset has some values as undefined for some specific requirements, hence I added sortUndefined : 1 as suggested in the docs.

After reviewing again my implementation I decided to try out reverting the lib version, and it worked just fine.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/hungry-rhodes-kf5f6p

Steps to reproduce

I'm not sure if it is only me, but creating a fork and updating the Sorting example in Codesandbox has been painful, it's been too slow these last few days. I had to lower the length of the dataset to 1000.

To reproduce the issue, my setup looks like this:

Create a dataset with rows containing some number values, for example:

const data = [{
  id: 1,
 amount: 10
},{
  id: 2,
  amount: undefined
}];

Then, on the column definitions:

{
 accessorKey: 'amount'
header:...
// Just an example...
cell: (props) => props.getValue() ?? '-'
sortUndefined: 1
}

Sorting by amount in descending will put undefined values on top.

Expected behavior

The expected behavior is: Sorting by amount in descending will put undefined values at the bottom of the table.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

MacOS - Chrome

react-table version

8.10.7

TypeScript version

5.3.2

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@MiccWan
Copy link
Contributor

MiccWan commented Apr 12, 2024

Updated: The behavior seems to be intended, which is changed in v8.9.2, commit 76a87cc061d4f72c40e7.

Also happens in 8.15.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants