diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2023-07-30 10:55:59 -0600 |
---|---|---|
committer | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2023-07-30 23:57:51 +0000 |
commit | 080d8b05297f3f5afcf33354a40a5201697b1df5 (patch) | |
tree | 35180bd3cb9fcd137feca3fe169032cbbb469463 /src/components/ui/select | |
parent | refactor: various improvements (#1296) (diff) | |
download | ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.gz ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.zst ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.zip |
refactor: more lint improvements
- set parserOptions.ecmaVersion to latest and env to es2024 in eslint config
- install missing types libraries
- install eslint-plugin-sonar
- enable eslint-plugin-sonar recommended rules and declare jsx-runtime for react in eslint config
- clean up disabled lint rules which don't inflict problems anymore
- disable various lint issues and fix others
Diffstat (limited to 'src/components/ui/select')
-rw-r--r-- | src/components/ui/select/index.tsx | 38 |
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 { |