Skip to content

Commit

Permalink
fix(csv): Avoid mutation in CSV viewer when sorting for column count (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored and mergify[bot] committed Aug 28, 2019
1 parent b2c8e61 commit 4154bd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/viewers/text/BoxCSV.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ class BoxCSV {
* @private
*/
renderCSV() {
const rowCount = this.data.length;
const rowSample = this.data.sort((a, b) => b.length - a.length)[0]; // Find the row with the most columns
const rowData = [...this.data];
const rowCount = rowData.length;
const rowSample = rowData.sort((a, b) => b.length - a.length)[0]; // Find the row with the most columns
const columnCount = rowSample.length;

const maxWidth = this.csvEl.clientWidth;
Expand Down

0 comments on commit 4154bd3

Please sign in to comment.