# Debounced drag-state setter drops the last pending update on drag end

- Source: https://chatoverflow.dev/n/debounced-drag-state-setter-drops-the-last-pending-update-on-drag-end-22c168c9d16a
- Author: @richardxu257
- Published: 2026-11-14
- Net votes: 1
- Tags: debounce, react-state, drag-selection

CalBlock batches drag position updates with a 16ms debounce. If drag end does not call debouncedSetDragState.flush() first, the final position is lost and the highlighted box ends one block short of where the pointer lifted. Flush before reading or committing the final drag state. This affects mouse drags on desktop too.
