Skip to content

Commit 3718cfa

Browse files
committed
refactor: improve null checks and declaration
1 parent 4c661cd commit 3718cfa

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/Common/Dialogs/DeleteDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
3030
props.delete()
3131
}
3232

33-
const handleKeyDown = async (event: KeyboardEvent) => {
33+
const handleKeyDown = (event: KeyboardEvent) => {
3434
if (event.key === 'Enter' && !isDeleteDisabled) {
3535
event.preventDefault()
3636

src/Common/Hooks/useUrlFilters/useUrlFilters.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ const useUrlFilters = <T = string, K = unknown>({
7373
const _resetPageNumber = () => {
7474
if (pageNumber !== DEFAULT_PAGE_NUMBER) {
7575
_updateSearchParam(PAGE_NUMBER, DEFAULT_PAGE_NUMBER)
76-
} else {
77-
history.replace({ search: searchParams.toString() })
76+
return
7877
}
78+
79+
history.replace({ search: searchParams.toString() })
7980
}
8081

8182
const changePage = (page: number) => {

src/Common/Modals/VisibleModal.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ export class VisibleModal extends React.Component<{
4949
}
5050
}
5151

52-
render() {
53-
const handleBodyClick = (e: SyntheticEvent) => {
54-
e.stopPropagation()
52+
handleBodyClick = (e: SyntheticEvent) => {
53+
e.stopPropagation()
5554

56-
this.props?.close?.(e)
57-
}
55+
this.props.close?.(e)
56+
}
5857

58+
render() {
5959
return ReactDOM.createPortal(
6060
<div
6161
className={`visible-modal__body ${this.props.className}`}
62-
onClick={handleBodyClick}
62+
onClick={this.handleBodyClick}
6363
data-testid="visible-modal-close"
6464
>
6565
{this.props.children}

src/Common/Modals/VisibleModal2.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ export class VisibleModal2 extends React.Component<{ className: string; close?:
3030
preventBodyScroll(false)
3131
}
3232

33-
render() {
34-
const handleBodyClick = (e: SyntheticEvent) => {
35-
e.stopPropagation()
33+
handleBodyClick = (e: SyntheticEvent) => {
34+
e.stopPropagation()
3635

37-
this.props?.close?.(e)
38-
}
36+
this.props.close?.(e)
37+
}
3938

39+
render() {
4040
return ReactDOM.createPortal(
4141
<div
4242
className={`visible-modal__body ${this.props.className}`}
43-
onClick={handleBodyClick}
43+
onClick={this.handleBodyClick}
4444
data-testid="visible-modal2-close"
4545
>
4646
{this.props.children}

0 commit comments

Comments
 (0)