coddicat / DebounceThrottle

C# Debounce and Throttle dispatchers
MIT License
48 stars 15 forks source link

Weirdness with DebounceDispatcher.DebounceAsync in new version #15

Open kinetiq opened 3 months ago

kinetiq commented 3 months ago

Could you make this perhaps accept a Func\<Task> delegate, or provide an example of how this is supposed to be used now?

Right now it's challenging to use this with actual async code.

In previous versions I could have this code:

await SaveDebouncer.DebounceAsync(SaveForm);

Here, SaveForm just returns a task. In this case, now it seems like I'm supposed to do this:

await SaveDebouncer.DebounceAsync(async () => await SaveForm());

...I can live with it being more verbose even though it seems unnecessary, but this generates a warning and that is a problem for my team.

Thanks for the great project!

lalibi commented 2 weeks ago

This change in the signature of the method DebounceAsync caused me troubles too, I had to downgrade to v2.1.0

Maybe there is a good reason behind it, but could it be an oversight?