-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debounce (protect against accidental multiple operations) #75
Comments
Please, first read this section of the documentation: https://pub.dev/packages/async_redux#progress-indicators There are many ways to do that:
|
It was just an example with button. |
Yes, as I said, the store does that with the persistor. I will see if I can expose this functionality for general use. |
For that purpose, I am using this library: https://pub.dev/packages/easy_debounce I am wrapping all dispatch() calls that I need to debounce with it. |
How to implement protection against too often heavy operations?
For instance, if I pressed the "Save" button quickly several times. I don't want to save multiple times.
I want to wait a 500 ms after last press and save only once.
In MobX we have a ready-made reaction 'delay' parameter (check the 101-105 lines):
https://github.com/brianegan/flutter_architecture_samples/blob/master/mobx/lib/stores/todo_store.dart
In a pure Provider architecture I'd use an RxDart debounce() to control saving:
But I have no idea, how to create similar functionality with Async Redux, because it's not recommended to keep streams in the store.
The text was updated successfully, but these errors were encountered: