Skip to content

Commit

Permalink
When adding sorted arrays to the beginning, make sure to insert them …
Browse files Browse the repository at this point in the history
…in the same order and not accidentally reverse them while inserting.
  • Loading branch information
shefalijoshi committed Oct 2, 2024
1 parent 43cc963 commit c21e129
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/telemetryTable/collections/TableRowCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c21e129

Please sign in to comment.