diff --git a/src/components/Pagination/Pagination.js b/src/components/Pagination/Pagination.js index d38003f..4cc4349 100644 --- a/src/components/Pagination/Pagination.js +++ b/src/components/Pagination/Pagination.js @@ -58,6 +58,12 @@ const Pagination = ({ } }; + const handleBlur = () => { + if (Number.isNaN(search)) { + setSearch(1); + } + }; + useEffect(() => { setPages(getPagesRange(null, currentPage, totalPages) || []); }, [totalPages]); @@ -115,8 +121,10 @@ const Pagination = ({ min={1} max={totalPages} onChange={handleChangeInput} - value={!Number.isNaN(search) ? search : 1} + defaultValue={1} + value={!Number.isNaN(search) ? search : undefined} onKeyDown={handleKeyDown} + onBlur={handleBlur} >