Skip to content
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

Add support for deboucing/throttle the notifyWidget #70

Open
robert-northmind opened this issue Dec 17, 2022 · 2 comments
Open

Add support for deboucing/throttle the notifyWidget #70

robert-northmind opened this issue Dec 17, 2022 · 2 comments
Labels
enhancement New feature or request Needs Estimation

Comments

@robert-northmind
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Well it is sort of a problem.
Say that you have a driver which listens to some stream and whenever that stream emits a value, then the driver want the widget to update. Do it calls 'notifyWidget'.

But what if that stream updates really often.

Or you listen to 2 streams and when any of them updates you want to call 'notifyWidget'.

Here it would be practical if you could batch the update calls (if they come close to each other and only trigger a widget update once.

So some denounce and/or throttle behavior.

Describe the solution you'd like
We could add a 'notifyWidget-update-behavior property on the drivers.

And then the developer could set the denounce/throttle behavior if wanted and then internally the widgetDriver framework could take care of this.

And by default if the developer takes no action, then a call to notifyWidget would always trigger a widget update.

We could also add a 'update-behavior' as an horizontal parameter to the 'notifyWidget' call. So that you could say that some calls should override them general behavior.
So if you have one trigger which calls notifyWidget often, then only for that you would call:
NotifyWidget(denounce: Duration(millisec: 300))

Describe alternatives you've considered
The alternative could be that each developer builds their own logic for this. But since it is a generic solution we could just put it in the framework.

@robert-northmind robert-northmind added the enhancement New feature or request label Dec 17, 2022
@robert-northmind robert-northmind changed the title Add support for deboucing the notifyWidget Add support for deboucing/throttle the notifyWidget Dec 17, 2022
@robert-northmind
Copy link
Collaborator Author

Here is a Stack Overflow for doing denounce in dart:

https://stackoverflow.com/questions/51791501/how-to-debounce-textfield-onchange-in-dart

@robert-northmind
Copy link
Collaborator Author

Team decided it makes sense to implement this.
But the exact way to implement is still open.
Before you start working on this ticket, please schedule a follow up call with the team and decide on the best approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs Estimation
Development

No branches or pull requests

1 participant