From 8ba826a0ea8c94a35075a4914a1883ec78063eb2 Mon Sep 17 00:00:00 2001 From: Purwa Shrivastava Date: Fri, 6 Dec 2019 10:12:07 +0100 Subject: [PATCH] Corrected the react error when componentDidUpdate is called. So the error message is uniformly shown in both analysis and edit mode. --- src/root.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/root.jsx b/src/root.jsx index e4dfbbf..01e8dcc 100644 --- a/src/root.jsx +++ b/src/root.jsx @@ -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(); + } } } @@ -66,7 +69,7 @@ class Root extends React.PureComponent { return (
{error ? ( -
+
{state.layout.errormessage}
) : (