From d1e09d36ed786eaf4fa0c03f3e33a59ff61d8bb4 Mon Sep 17 00:00:00 2001 From: Michael Fix Date: Wed, 8 Jan 2020 08:53:14 -0800 Subject: [PATCH] Remove cWRP from ChromeFields (#661) --- src/components/chrome/ChromeFields.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/chrome/ChromeFields.js b/src/components/chrome/ChromeFields.js index 6b4424ea..48aa76bb 100644 --- a/src/components/chrome/ChromeFields.js +++ b/src/components/chrome/ChromeFields.js @@ -22,10 +22,11 @@ export class ChromeFields extends React.Component { } } - componentWillReceiveProps(nextProps) { - if (nextProps.hsl.a !== 1 && this.state.view === 'hex') { - this.setState({ view: 'rgb' }) + static getDerivedStateFromProps(nextProps, state) { + if (nextProps.hsl.a !== 1 && state.view === 'hex') { + return { view: 'rgb' } } + return null } toggleViews = () => {