Handle sorting with "undefined" (move always to bottom) (#7985)

This commit is contained in:
Philip Allgaier 2020-12-29 22:45:39 +01:00 committed by GitHub
parent 2c54158d84
commit 371ad899f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,14 @@ const sortData = (
valB = valB.toUpperCase();
}
// Ensure "undefined" is always sorted to the bottom
if (valA === undefined && valB !== undefined) {
return 1;
}
if (valB === undefined && valA !== undefined) {
return -1;
}
if (valA < valB) {
return sort * -1;
}