aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/select/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ui/select/index.tsx')
-rw-r--r--src/components/ui/select/index.tsx15
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
461export const Select = injectStyle(styles, { injectTheme: true })( 466export default injectStyle(styles, { injectTheme: true })(
462 SelectComponent, 467 SelectComponent,
463); 468);