Skip to content

Commit

Permalink
Default retrieve value to limit when negative values are entered
Browse files Browse the repository at this point in the history
Signed-off-by: hemahg <[email protected]>
  • Loading branch information
hemahg committed Jan 16, 2025
1 parent 11c771a commit 6be189d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ui/components/MessagesTable/components/AdvancedSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,11 @@ export function AdvancedSearch({
<FormGroup label={"Retrieve"}>
<UntilGroup
limit={limit ?? 50}
onLimitChange={(limit) => {
setLimit(limit);
onLimitChange={(newLimit) => {
const validatedLimit = newLimit !== undefined && newLimit >= 0 ? newLimit : limit;
setLimit(validatedLimit);
}}

onLive={() => {
setLimit("continuously");
}}
Expand Down
2 changes: 1 addition & 1 deletion ui/components/MessagesTable/components/parseSearchInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function parseSearchInput({ value }: { value: string }): SearchParams {
sp.limit = "continuously";
} else {
const number = parseInt(limit, 10);
if (Number.isSafeInteger(number)) {
if (Number.isSafeInteger(number) && number >= 0) {
sp.limit = number;
}
}
Expand Down

0 comments on commit 6be189d

Please sign in to comment.