Skip to content

Commit

Permalink
fix: Solves warning for modifying state directly; now this.setState
Browse files Browse the repository at this point in the history
  • Loading branch information
hcat-pge committed May 1, 2020
1 parent 5b593e4 commit a7cb383
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion front-end/src/components/CustomNode/GraphView.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default class GraphView extends React.Component {
computeWidths = (columns, rowCount, data) => {
const columnCount = columns.length;
const widths = new Array(columnCount);
let maxWidth = this.state.maxWidth;

for (let index = 0; index < columnCount; index++) {
const column = columns[index];
Expand All @@ -58,10 +59,11 @@ export default class GraphView extends React.Component {
widths[index] = row.length;
}

this.state.maxWidth += (widths[index] * 10);
maxWidth += widths[index] * 10;
}
}

this.setState({maxWidth: maxWidth});
return widths;
};

Expand Down

0 comments on commit a7cb383

Please sign in to comment.