Skip to content

Commit 83e4a12

Browse files
shefalijoshiakhenryunlikelyzero
authored
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 <[email protected]> Co-authored-by: John Hill <[email protected]>
1 parent 47f0b66 commit 83e4a12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/plugins/telemetryTable/collections/TableRowCollection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ export default class TableRowCollection extends EventEmitter {
150150
}
151151

152152
insertOrUpdateRows(rowsToAdd, addToBeginning) {
153-
rowsToAdd.forEach((row) => {
153+
rowsToAdd.forEach((row, addRowsIndex) => {
154154
const index = this.getInPlaceUpdateIndex(row);
155155
if (index > -1) {
156156
this.updateRowInPlace(row, index);
157157
} else {
158158
if (addToBeginning) {
159-
this.rows.unshift(row);
159+
this.rows.splice(addRowsIndex, 0, row);
160160
} else {
161161
this.rows.push(row);
162162
}

0 commit comments

Comments
 (0)