diff --git a/frontend/webapp/containers/main/actions/choose-action-body/custom-fields/error-sampler.tsx b/frontend/webapp/containers/main/actions/choose-action-body/custom-fields/error-sampler.tsx index 692fa30aa..e089dcf90 100644 --- a/frontend/webapp/containers/main/actions/choose-action-body/custom-fields/error-sampler.tsx +++ b/frontend/webapp/containers/main/actions/choose-action-body/custom-fields/error-sampler.tsx @@ -17,11 +17,7 @@ const ErrorSampler: React.FC = ({ value, setValue }) => { const mappedValue = useMemo(() => safeJsonParse(value, { fallback_sampling_ratio: 0 }).fallback_sampling_ratio, [value]); const handleChange = (val: string) => { - let num = Number(val); - - if (Number.isNaN(num) || num < MIN || num > MAX) { - num = MIN; - } + const num = Math.max(MIN, Math.min(Number(val), MAX)) || MIN; const payload: Parsed = { fallback_sampling_ratio: num,