OE-3 UI: Limit Ladder- Rung count input snaps to minimum on backspace; cannot type a new value from scratch #295
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#295
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary:
The rung count input in the limit ladder panel has an unusable editing experience. The default is 5. Backspacing to clear the field immediately snaps the value to 2 (the minimum), and the input cannot be cleared or retyped. Any value above the contract maximum (20) is silently clamped to 20 with no feedback. The user cannot freely type a new rung count.
Reproduction steps
/limitsor/trade/:pairAddrand open the Limit Ladder section552instead of allowing an empty field2— it does not clear3,10, or any value less than 20 — the field does not accept it cleanly20(e.g.25) — field is clamped to20with no messageExpected behavior
3should result in3, not2Actual behavior
2on every keystrokeVerified root cause (code read and confirmed)
LimitOrderLadderPanel.tsxline 231:The
onChangehandler coerces and clamps on every keystroke:5,e.target.valuebecomes""(empty string)Number("") === 0, soNumber(e.target.value) || 2evaluates to2Math.max(2, 2)→2,Math.min(20, 2)→2— state is set to2immediatelyvalue={rungCount}=2, overwriting the input2and cannot clear it — every backspace triggers the same snapValues above
maxRungs(20) hitMath.min(maxRungs, ...)and are silently capped with no user message.Relevant state:
useState(5)at line 54maxRungs:configQuery.data?.max_batch_rungs ?? 20at line 61 (fetched from contract config)type="number",min={2},max={maxRungs},data-testid="ladder-rung-count"at lines 226–232Fix direction: Decouple the input's display value from the numeric state. Use a local string state (e.g.
rungCountInput) for the controlled input value, and only parse/clamp intorungCounton blur or when the value is a valid integer within range. This is the standard pattern for numeric inputs that need mid-edit empty states.Impact assessment
Environment
/limitsLimit Ladder sectionSeverity: ~bug : the core ladder placement flow still works at the default rung count, but the rung count field is functionally broken for any non-default value. Affects configurability, not availability.
Related checklist items: OE-3
cc: @PlasticDigits
mentioned in issue #291
Confirmed against current source (frontend-only, your layer to fix/verify in browser).
LimitOrderLadderPanel.tsx:231clamps on every keystroke:setRungCount(Math.min(maxRungs, Math.max(2, Number(e.target.value) || 2)))on a controlledvalue={rungCount}input — so backspacing to empty makesNumber("")===0 → 2, and React immediately re-renders2, blocking a clear/retype. Standard fix: decouple a local string input state from the numericrungCount, parse+clamp only on blur/submit (allow an intermediate empty value mid-edit). Real, low — placement still works at the default 5. @totdkingmentioned in merge request !757
Fixed in MR !757 (bundled the four ladder-panel fixes — they're one component). For #295: decoupled the rung-count input from the numeric state — a raw string draft drives the field so backspacing no longer snaps to 2, and it clamps/normalizes on blur. Over-max now shows an inline message instead of silently capping. The numeric rungCount stays the source of truth for the preview/plan/gas/mutation. Frontend-only — the browser walkthrough (backspace to empty, type 3, type 25 to trigger the message, blur to clamp) is yours. @PlasticDigits
mentioned in commit
6e42a5b6f6Verification — GitLab #295 (OE-3: limit ladder rung count input)
Verified on
main@9f0babe(includes MR !757 /6e42a5b).Acceptance criteria
rungCountInput), parse on valid keystrokes, clamp on blurLimitOrderLadderPanel.tsx—handleRungCountChange,handleRungCountBlur,rungCountError; oldonChangeclamp removed2@testing-library/user-event:clear()→value === '', no error banner3→ field shows3(not2)type('3')→value === '3'25→ inline message (not silent cap while typing)ladder-rung-count-errorcontains “at most 20”25→value === '20', error cleared5rg 'Number(e.target.value) || 2'— no matches infrontend-dappmake lint-frontendmake test-frontend/limits(human QA note in MR !757)frontend-dapp/.env.local/ LocalTerra stack running in this session; UI behavior covered by Testing Library user-event reproduction aboveSummary
The reported bug is fixed on
main. MR !757 landed the string-draft + blur-clamp pattern and inline over-max validation. No additional repo changes were required for this verification pass.Closing as verified.
mentioned in commit
b4432f658fmentioned in merge request !769
mentioned in commit
0f2d3c2d34mentioned in commit
816fec5d92mentioned in issue #337
mentioned in issue #385