diff options
author | 2022-07-07 09:31:50 +0200 | |
---|---|---|
committer | 2022-07-07 09:31:50 +0200 | |
commit | 71c52373f81cace664047edd19d9d289f45a4dff (patch) | |
tree | 69b3f1d45a8b3f1ceab9497ea3c96e9dc18e3166 /src/components/ui/button/index.tsx | |
parent | 6.0.0-nightly.91 [skip ci] (diff) | |
download | ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.gz ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.zst ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.zip |
chore: Mobx & React-Router upgrade (#406)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/components/ui/button/index.tsx')
-rw-r--r-- | src/components/ui/button/index.tsx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx index 26fd6bcfe..a8bbfe730 100644 --- a/src/components/ui/button/index.tsx +++ b/src/components/ui/button/index.tsx | |||
@@ -169,20 +169,18 @@ class ButtonComponent extends Component<IProps> { | |||
169 | busy: false, | 169 | busy: false, |
170 | }; | 170 | }; |
171 | 171 | ||
172 | componentWillMount() { | 172 | constructor(props: IProps) { |
173 | this.setState({ busy: this.props.busy }); | 173 | super(props); |
174 | |||
175 | this.state = { | ||
176 | busy: props.busy || false, | ||
177 | }; | ||
174 | } | 178 | } |
175 | 179 | ||
176 | componentWillReceiveProps(nextProps: IProps) { | 180 | static getDerivedStateFromProps(nextProps: IProps) { |
177 | if (nextProps.busy !== this.props.busy) { | 181 | return { |
178 | if (this.props.busy) { | 182 | busy: nextProps.busy, |
179 | setTimeout(() => { | 183 | }; |
180 | this.setState({ busy: nextProps.busy }); | ||
181 | }, 300); | ||
182 | } else { | ||
183 | this.setState({ busy: nextProps.busy }); | ||
184 | } | ||
185 | } | ||
186 | } | 184 | } |
187 | 185 | ||
188 | render() { | 186 | render() { |