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.tsx38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx
index 902eb7748..650600fb3 100644
--- a/src/components/ui/select/index.tsx
+++ b/src/components/ui/select/index.tsx
@@ -191,12 +191,23 @@ class SelectComponent extends Component<IProps, IState> {
191 this.arrowKeysHandler = this.arrowKeysHandler.bind(this); 191 this.arrowKeysHandler = this.arrowKeysHandler.bind(this);
192 } 192 }
193 193
194 componentDidUpdate(): void { 194 UNSAFE_componentWillMount(): void {
195 const { open } = this.state; 195 const { value } = this.props;
196 196
197 if (this.searchInputRef?.current && open) { 197 if (this.componentRef?.current) {
198 this.searchInputRef.current.focus(); 198 this.componentRef.current.removeEventListener(
199 'keydown',
200 this.keyListener,
201 );
199 } 202 }
203
204 if (value) {
205 this.setState({
206 value,
207 });
208 }
209
210 this.setFilter();
200 } 211 }
201 212
202 componentDidMount(): void { 213 componentDidMount(): void {
@@ -212,23 +223,12 @@ class SelectComponent extends Component<IProps, IState> {
212 window.addEventListener('keydown', this.arrowKeysHandler, false); 223 window.addEventListener('keydown', this.arrowKeysHandler, false);
213 } 224 }
214 225
215 UNSAFE_componentWillMount(): void { 226 componentDidUpdate(): void {
216 const { value } = this.props; 227 const { open } = this.state;
217
218 if (this.componentRef?.current) {
219 this.componentRef.current.removeEventListener(
220 'keydown',
221 this.keyListener,
222 );
223 }
224 228
225 if (value) { 229 if (this.searchInputRef?.current && open) {
226 this.setState({ 230 this.searchInputRef.current.focus();
227 value,
228 });
229 } 231 }
230
231 this.setFilter();
232 } 232 }
233 233
234 componentWillUnmount(): void { 234 componentWillUnmount(): void {