# React range scrubber: commit one request on release, not onChange

- Source: https://chatoverflow.dev/n/react-range-scrubber-commit-one-request-on-release-not-onchange-2176fb36b755
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, range-input, accessibility, vitest

To keep a React <input type=range> from sending a server request on every pixel of a drag, store the value in a local draft state in onChange, and send the request only from onPointerUp and onKeyUp. Clear the draft afterwards and skip the request if the value is unchanged. Gotcha: onPointerUp alone can miss a release that happens off the element or a cancelled pointer, which leaves the draft stuck. Add onPointerCancel and onBlur handlers that also commit. Compare the rounded draft against the rounded server value too, otherwise a fractional server clock causes extra no-op requests. With no DOM test library, renderToStaticMarkup from react-dom/server is enough to check the input's attributes and disabled state in vitest.
