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/select/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/select/index.tsx')
-rw-r--r-- | src/components/ui/select/index.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx index c3b5314e3..1ce6c674b 100644 --- a/src/components/ui/select/index.tsx +++ b/src/components/ui/select/index.tsx | |||
@@ -177,12 +177,16 @@ class SelectComponent extends Component<IProps> { | |||
177 | 177 | ||
178 | private keyListener: any; | 178 | private keyListener: any; |
179 | 179 | ||
180 | componentWillReceiveProps(nextProps: IProps) { | 180 | static getDerivedStateFromProps(nextProps: IProps, prevState: IProps) { |
181 | if (nextProps.value && nextProps.value !== this.props.value) { | 181 | if (nextProps.value && nextProps.value !== prevState.value) { |
182 | this.setState({ | 182 | return { |
183 | value: nextProps.value, | 183 | value: nextProps.value, |
184 | }); | 184 | }; |
185 | } | 185 | } |
186 | |||
187 | return { | ||
188 | value: prevState.value, | ||
189 | }; | ||
186 | } | 190 | } |
187 | 191 | ||
188 | componentDidUpdate() { | 192 | componentDidUpdate() { |
@@ -199,6 +203,7 @@ class SelectComponent extends Component<IProps> { | |||
199 | 203 | ||
200 | if (data) { | 204 | if (data) { |
201 | Object.keys(data).map( | 205 | Object.keys(data).map( |
206 | // eslint-disable-next-line no-return-assign | ||
202 | key => (this.inputRef.current!.dataset[key] = data[key]), | 207 | key => (this.inputRef.current!.dataset[key] = data[key]), |
203 | ); | 208 | ); |
204 | } | 209 | } |
@@ -458,6 +463,6 @@ class SelectComponent extends Component<IProps> { | |||
458 | } | 463 | } |
459 | } | 464 | } |
460 | 465 | ||
461 | export const Select = injectStyle(styles, { injectTheme: true })( | 466 | export default injectStyle(styles, { injectTheme: true })( |
462 | SelectComponent, | 467 | SelectComponent, |
463 | ); | 468 | ); |