This is a placeholder issue for adding debounce functionality for form controls.
Still figuring out the API for this. :thinking: If you have suggestions, feel free to list them here!
I want to make this as unopinionated and flexible as possible, including but not limited to:
--x----x vs. x--x---x)requestAnimationFrame, or at a custom interval)(this is getting pretty reactive!)
I decided to ship an MVP API for this that is as simple as humanly possible and covers 97% of use cases:
<Control model="user.name" debounce={300} />
The viewValue will always be updated immediately, but the model value will be debounced properly.
@davidkpiano I was trying a use case where I wanted to delay the value when using a parser. That way if i was doing a date for instance and replacing every two characters with a / it would work when backspacing. The debounce does not appear to work with the parse method.
@greghawk Can you spin up an example that replicates the issue?
I can. Pretty simple though
Awesome, want to file another issue? I'll take care of it soon.
Great! I can do that. I had talked to you before about parsers/formatters and you mentioned race conditions. I think if we can get debounce working on parsers things like currency, date and masking things may be possible with the right debounce setting. Also i noticed the docs mentioned that the parser prop has an optional "previous" param. I don't see this ever getting hydrated and in the most recent build i don't see anything passing it either in the source code.
Most helpful comment
I decided to ship an MVP API for this that is as simple as humanly possible and covers 97% of use cases:
The
viewValuewill always be updated immediately, but the model value will be debounced properly.