fix(web): align sanitizeSteps NaN fallback with STEPS_MIN (#2)

When a non-numeric value reached sanitizeSteps(), the NaN branch fell
back to a hardcoded 8 instead of STEPS_MIN (1). This was inconsistent
with sanitizeDimension() (which falls back to DIM_MIN) and with the
Python backend's _sanitize_steps(), which clamps invalid input to
STEPS_MIN. A user clearing the steps field could see a different value
applied client-side than the server would compute.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gérald LONLAS
2026-06-27 09:35:03 +08:00
committed by GitHub
co-authored by Claude Opus 4.8
parent a889285a37
commit 7fe163ff5f
+1 -1
View File
@@ -452,7 +452,7 @@ function sanitizeDimension(value) {
function sanitizeSteps(value) {
let integer = Number.parseInt(value, 10);
if (Number.isNaN(integer)) {
integer = 8;
integer = STEPS_MIN;
}
const nextValue = clamp(integer, STEPS_MIN, STEPS_MAX);