From 99cd2dceecad7368e04818f6983f3f64fe94502e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Sep 2020 12:07:24 +0100 Subject: [PATCH] Fix create-react-class regression. Can't call setState in c'tor --- src/components/views/elements/PowerSelector.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/PowerSelector.js b/src/components/views/elements/PowerSelector.js index e5f217dd90..66922df0f8 100644 --- a/src/components/views/elements/PowerSelector.js +++ b/src/components/views/elements/PowerSelector.js @@ -57,11 +57,14 @@ export default class PowerSelector extends React.Component { customValue: this.props.value, selectValue: 0, }; - - this._initStateFromProps(this.props); } // TODO: [REACT-WARNING] Replace with appropriate lifecycle event + // eslint-disable-next-line camelcase + UNSAFE_componentWillMount() { + this._initStateFromProps(this.props); + } + // eslint-disable-next-line camelcase UNSAFE_componentWillReceiveProps(newProps) { this._initStateFromProps(newProps);