Fix table sorting in descending order (#7863)

When adding sorted arrays to the beginning, make sure to insert them in the same order and not accidentally reverse them while inserting.

Co-authored-by: Andrew Henry <akhenry@gmail.com>
Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
Shefali Joshi 2024-10-08 06:56:28 -07:00 committed by GitHub
parent 47f0b66c7e
commit 83e4a124e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,13 +150,13 @@ export default class TableRowCollection extends EventEmitter {
}
insertOrUpdateRows(rowsToAdd, addToBeginning) {
rowsToAdd.forEach((row) => {
rowsToAdd.forEach((row, addRowsIndex) => {
const index = this.getInPlaceUpdateIndex(row);
if (index > -1) {
this.updateRowInPlace(row, index);
} else {
if (addToBeginning) {
this.rows.unshift(row);
this.rows.splice(addRowsIndex, 0, row);
} else {
this.rows.push(row);
}