Skip to content

Commit 489efd8

Browse files
committed
fix: fix
1 parent e9a1942 commit 489efd8

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/Options.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ const Options: React.FC<OptionsProps> = (props) => {
4848

4949
const [goInputText, setGoInputText] = React.useState('');
5050

51-
const getValidValue = () => {
51+
const getValidValue = React.useMemo<number>(() => {
5252
return !goInputText || Number.isNaN(goInputText)
5353
? undefined
5454
: Number(goInputText);
55-
};
55+
}, [goInputText]);
5656

5757
const mergeBuildOptionText =
5858
typeof buildOptionText === 'function'
@@ -70,12 +70,12 @@ const Options: React.FC<OptionsProps> = (props) => {
7070
setGoInputText('');
7171
if (
7272
e.relatedTarget &&
73-
(e.relatedTarget.className.indexOf(`${rootPrefixCls}-item-link`) >= 0 ||
74-
e.relatedTarget.className.indexOf(`${rootPrefixCls}-item`) >= 0)
73+
(e.relatedTarget.className.includes(`${rootPrefixCls}-item-link`) ||
74+
e.relatedTarget.className.includes(`${rootPrefixCls}-item`))
7575
) {
7676
return;
7777
}
78-
quickGo?.(getValidValue());
78+
quickGo?.(getValidValue);
7979
};
8080

8181
const go = (e: any) => {
@@ -84,7 +84,7 @@ const Options: React.FC<OptionsProps> = (props) => {
8484
}
8585
if (e.keyCode === KEYCODE.ENTER || e.type === 'click') {
8686
setGoInputText('');
87-
quickGo?.(getValidValue());
87+
quickGo?.(getValidValue);
8888
}
8989
};
9090

src/Pagination.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ import Options from './Options';
1010
import type { PagerProps } from './Pager';
1111
import Pager from './Pager';
1212

13-
const defaultItemRender: PaginationProps['itemRender'] = (
14-
page,
15-
type,
16-
element,
17-
) => element;
13+
const defaultItemRender: PaginationProps['itemRender'] = (_, __, element) =>
14+
element;
1815

1916
function noop() {}
2017

@@ -244,8 +241,8 @@ const Pagination: React.FC<PaginationProps> = (props) => {
244241

245242
function runIfEnter(
246243
event: React.KeyboardEvent<HTMLLIElement>,
247-
callback,
248-
...restParams
244+
callback: (...args: any[]) => void,
245+
...restParams: any[]
249246
) {
250247
if (
251248
event.key === 'Enter' ||

0 commit comments

Comments
 (0)