Skip to content

Commit

Permalink
Merge pull request #80 from qlik-oss/QB-377/errorMessage
Browse files Browse the repository at this point in the history
Corrected the react error when componentDidUpdate is called. So the e…
  • Loading branch information
PurwaShrivastava authored Dec 6, 2019
2 parents d244639 + 8ba826a commit 58d0f54
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ class Root extends React.PureComponent {
}

componentDidUpdate () {
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
if (this.renderedTableWidth !== tableWidth) {
this.forceUpdate();
let tableWidth;
if (this.dataTableRef) {
tableWidth = this.dataTableRef.getBoundingClientRect().width;
if (this.renderedTableWidth !== tableWidth) {
this.forceUpdate();
}
}
}

Expand Down Expand Up @@ -66,7 +69,7 @@ class Root extends React.PureComponent {
return (
<div className="root">
{error ? (
<div className="error">
<div className={`error ${editmodeClass}`}>
{state.layout.errormessage}
</div>
) : (
Expand Down

0 comments on commit 58d0f54

Please sign in to comment.