Skip to content

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

Merged
T4rk1n merged 3 commits into
devfrom
fix/number-input-stepper-debounce
Nov 26, 2026
Merged

T4rk1n merged 3 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
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Dash performance benchmarks

✅ all within thresholds

scenario metric p90 (ms) median growth baseline p90 note
✅ callback_chain chain_ms 334.8 326.4 0.84x 595.4
✅ callback_chain graph_ms 1.1 1.1 1.0x 2.1
✅ callback_fanout fanout_ms 57.7 51.5 0.96x 88.3
✅ callback_fanout_children_update fanout_ms 99.7 91.6 0.92x 164.8
✅ deep_nesting render_ms 41.8 38.6 1.18x 61.1
✅ full_children_replace replace_ms 105.7 75.9 2.48x 161.2
✅ initial_render_large render_ms 430.0 408.3 0.88x 697.8
✅ initial_render_small render_ms 82.0 71.9 1.16x 102.7
✅ patch_append_nested append_ms 107.8 64.7 1.96x 127.2
✅ patch_append_toplevel append_ms 100.4 69.6 2.55x 165.8
✅ patch_scalar_update_large update_ms 114.0 93.8 0.83x 144.7
✅ rerender_existing_subtree rerender_ms 97.4 79.4 0.96x 121.0
✅ wildcard_all_resolve wildcard_ms 187.3 168.4 0.92x 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.73x - 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.

@sonarqubecloud

Copy link
Copy Markdown

@T4rk1n
T4rk1n merged commit 44c726d into dev Nov 26, 2026
52 of 53 checks passed
@T4rk1n
T4rk1n deleted the fix/number-input-stepper-debounce branch November 26, 2026 14:26
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