-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Table] Fix Sorting & Selecting
tables
#36898
Conversation
Netlify deploy previewhttps://deploy-preview-36898--material-ui.netlify.app/ Bundle size report |
); | ||
const handleRequestSort = (event, property) => { | ||
const isAsc = orderBy === property && order === 'asc'; | ||
setOrder(isAsc ? 'desc' : 'asc'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about simplifying this?
const handleRequestSort = (event, property) => {
setOrder(orderBy === property && order === 'asc' ? 'desc' : 'asc');
setOrderBy(property);
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could but it won't make much a difference. isAsc
has an interesting semantic meaning.
@oliviertassinari Awesome work! I learned a new thing! :D Adding the
Where did you get this number from? |
@ZeeshanTamboli The scrollbar is messed-up. Disable JavaScript, you will see how the list is empty:
It's really fast let array = [...new Array(10000)].map((x, index) => index);
console.time('filter');
array.filter((x) => `${x}` === '1000');
console.timeEnd('filter'); |
Revert #33236, the logic is 1. has bugs, 2. duplicate the filtering logic, and 3. do the opposite of what's recommended:
stableSort()
is written.To make the review of the changes easier, I have done two commits 1. revert 2. a fix for the original issue. But in practice, I doubt that this has any kind of impact on the operation. The memo is fast, even with 10,000 records (but how do you fetch 10,000 records client-side?). I was close to simply proposing a revert.