Flush and cancel on useDebouncedCallback? #7271
scamden
started this conversation in
Feature requests
Replies: 2 comments
-
(I'm happy to submit a PR here if it greases this wheel but want to gauge interest before doing the work) |
Beta Was this translation helpful? Give feedback.
0 replies
-
went ahead and opened a PR since i implemented locally anyway: #7272 Open to adding some tests etc if the idea feels reasonable. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It's fairly common to have these two features on a debounce. Any chance yall could add? Flush just immediately calls the callback with the last argument received and cancel does what it says and cancels the last timeout.
Specifically I'd use the flush feature to force persistence of data on unMount for some use cases. Currently if the user is very fast they can beat the timeout, unmount the component and the timeout is canceled, losing their changes.
Beta Was this translation helpful? Give feedback.
All reactions