Skip to content

Fix number input reverting typed value after stepper clicks with debounce - #4197

Open
T4rk1n wants to merge 2 commits into
devfrom
fix/number-input-stepper-debounce
Open

T4rk1n wants to merge 2 commits into
devfrom
fix/number-input-stepper-debounce

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Salvages the Input.tsx fix from #4041 by @brandonschabell. The rest of that PR (flaky test changes) was superseded by #4161 and #4188.

Bug

With dcc.Input(type="number", debounce=<seconds>), clicking a stepper button called onEvent(), which clears pendingEvent while the debounce timer started by the value effect is still running. That timer can no longer be cancelled. When it fires, its own onEvent() clears pendingEvent again and orphans the next timer. Eventually a stale timer skips setProps (its props.value base is stale) and clears pendingEvent, and the props.value effect writes an old value over what the user typed.

Example: click a stepper twice, then type and edit within the debounce window. A digit you deleted comes back.

Fix

The stepper calls setPropValue directly, so it pushes the value without touching pendingEvent.

Test

test_inni012_stepper_does_not_orphan_debounce lines up clicks and keystrokes so timers overlap. It fails on dev (output 10274 instead of 1027) and passes with the fix. The test_inni012 from #4041 passed on both, since clicks alone keep props and the DOM in sync and can't trigger the revert.

T4rk1n and others added 2 commits November 25, 2026 15:06
The stepper called onEvent(), which cleared pendingEvent while a debounce
timer was still live. That timer could no longer be cancelled, and each
orphan that fired cleared pendingEvent again, so a late timer could write
an old value back over what the user had typed.

Fix found by Brandon Schabell in #4041.

Co-authored-by: Brandon Schabell <brandonschabell@gmail.com>
@T4rk1n T4rk1n mentioned this pull request Nov 25, 2026
2 tasks done
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Dash performance benchmarks

✅ all within thresholds

scenario metric p90 (ms) median growth baseline p90 note
✅ callback_chain chain_ms 324.2 312.1 0.96x 595.4
✅ callback_chain graph_ms 1.6 1.6 1.0x 2.1
✅ callback_fanout fanout_ms 67.5 60.1 0.88x 88.3
✅ deep_nesting render_ms 42.9 39.9 1.05x 61.1
✅ full_children_replace replace_ms 134.2 78.4 3.04x 161.2
✅ initial_render_large render_ms 462.9 427.5 0.94x 697.8
✅ initial_render_small render_ms 86.0 75.7 1.15x 102.7
✅ patch_append_nested append_ms 94.3 66.9 2.45x 127.2
✅ patch_append_toplevel append_ms 94.4 66.4 2.22x 165.8
✅ patch_scalar_update_large update_ms 109.5 98.8 1.0x 144.7
✅ rerender_existing_subtree rerender_ms 80.8 74.8 0.98x 121.0
✅ wildcard_all_resolve wildcard_ms 222.6 210.2 0.95x 313.4
✅ wildcard_all_resolve graph_ms 0.8 0.8 1.0x 1.2

growth = late-third / early-third per-op time; ~1 is flat, a large value means the per-op cost scales with accumulated state.

machine scale vs baseline: 0.77x - divided out of the baseline ratios so they compare like for like (the absolute warn/fail ceilings are left un-scaled); calibrated on initial_render_small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant