Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 0f40512

Browse files
committed
Flush updates before blur if Control is debounceable
Blurring before updates are finished causes the field to have a touched state but not have the latest value. If a error handler only shows error if a field has been touched, the error message will be visible for the duration of the debounce before disappearing.
1 parent 7ac2965 commit 0f40512

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/components/control-component-factory.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ function createControlClass(s) {
137137

138138
if (props.debounce) {
139139
this.handleUpdate = debounce(this.handleUpdate, props.debounce);
140+
const oldHandleBlur = this.handleBlur;
141+
this.handleBlur = (...args) => {
142+
this.handleUpdate.flush();
143+
oldHandleBlur.call(this, args);
144+
};
140145
}
141146

142147
this.willValidate = false;

0 commit comments

Comments
 (0)