diff options
Diffstat (limited to 'ui-react/src/components/loop_viewer/svg/SvgGenerator.js')
-rw-r--r-- | ui-react/src/components/loop_viewer/svg/SvgGenerator.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ui-react/src/components/loop_viewer/svg/SvgGenerator.js b/ui-react/src/components/loop_viewer/svg/SvgGenerator.js index f5f5047ba..6d3cd7a21 100644 --- a/ui-react/src/components/loop_viewer/svg/SvgGenerator.js +++ b/ui-react/src/components/loop_viewer/svg/SvgGenerator.js @@ -59,16 +59,16 @@ class SvgGenerator extends React.Component { } shouldComponentUpdate(nextProps, nextState) { - return this.state.loopCache !== nextState.loopCache; + return this.state.loopCache !== nextProps.loopCache; } - componentWillReceiveProps(newProps) { - if (this.state.loopCache !== newProps.loopCache) { - this.setState({ - loopCache: newProps.loopCache, - }); - } - } + componentDidUpdate(prevProps) { + if (prevProps.loopCache !== this.props.loopCache) { + this.setState({ + loopCache: this.props.loopCache, + }); + } + } handleSvgClick(event) { console.debug("svg click event received"); @@ -233,10 +233,10 @@ class SvgGenerator extends React.Component { return ( <DivStyled onClick={this.handleSvgClick} > - <svg height={svgHeight} width={svgWidth} viewBox="0,0,{svgWidth},{svgHeight}" preserveAspectRatio="none"> - <svg x="-50" y="25"> - {allTheElements} - </svg> + <svg key="main" height={svgHeight} width={svgWidth} viewBox="0,0,{svgWidth},{svgHeight}" preserveAspectRatio="none"> + <svg key="content" x="-50" y="25"> + {allTheElements} + </svg> </svg> </DivStyled> ); |