From 83e4a124e2a6727651d82acd49eb1854b4f105ac Mon Sep 17 00:00:00 2001 From: Shefali Joshi Date: Tue, 8 Oct 2024 06:56:28 -0700 Subject: [PATCH] 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 Co-authored-by: John Hill --- src/plugins/telemetryTable/collections/TableRowCollection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/telemetryTable/collections/TableRowCollection.js b/src/plugins/telemetryTable/collections/TableRowCollection.js index d82c383136..20f294d3d7 100644 --- a/src/plugins/telemetryTable/collections/TableRowCollection.js +++ b/src/plugins/telemetryTable/collections/TableRowCollection.js @@ -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); }