mirror of
https://github.com/stashapp/stash.git
synced 2025-12-28 03:03:02 +01:00
Clamp page size maximum (#1920)
This commit is contained in:
parent
b01c4468d8
commit
ad7bb9a46f
1 changed files with 8 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ import { FormattedMessage, useIntl } from "react-intl";
|
|||
import { PersistanceLevel } from "src/hooks/ListHook";
|
||||
import { SavedFilterList } from "./SavedFilterList";
|
||||
|
||||
const maxPageSize = 1000;
|
||||
interface IListFilterProps {
|
||||
onFilterUpdate: (newFilter: ListFilterModel) => void;
|
||||
filter: ListFilterModel;
|
||||
|
|
@ -90,11 +91,16 @@ export const ListFilter: React.FC<IListFilterProps> = ({
|
|||
|
||||
setCustomPageSizeShowing(false);
|
||||
|
||||
const pp = parseInt(val, 10);
|
||||
let pp = parseInt(val, 10);
|
||||
if (Number.isNaN(pp) || pp <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't allow page sizes over 1000
|
||||
if (pp > maxPageSize) {
|
||||
pp = maxPageSize;
|
||||
}
|
||||
|
||||
const newFilter = _.cloneDeep(filter);
|
||||
newFilter.itemsPerPage = pp;
|
||||
newFilter.currentPage = 1;
|
||||
|
|
@ -334,6 +340,7 @@ export const ListFilter: React.FC<IListFilterProps> = ({
|
|||
<Form.Control
|
||||
type="number"
|
||||
min={1}
|
||||
max={maxPageSize}
|
||||
className="text-input"
|
||||
ref={perPageInput}
|
||||
onKeyPress={(e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue