-
Notifications
You must be signed in to change notification settings - Fork 95
DispatcherQueueTimerExtensions.Debounce does not work with leading edge action #143
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
Comments
Hello huynhsontung, thank you for opening an issue with us! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌 |
Thanks for the issue @huynhsontung, moved this to the new repo. Seems like we just have a couple of simple tests and not one for this scenario: https://github.com/CommunityToolkit/Windows/blob/main/components/Extensions/tests/DispatcherQueueTimerExtensionTests.cs In immediate mode though, there should be only one firing of the event at the start. It'll only fire again if a request comes in after the elapsed period of time. For my clarity, is that not what you're observing? Or you're saying that it never fires again after the first time? The docs don't say what the default should be, I filed an issue: MicrosoftDocs/winrt-api#2386 I would have thought In either case, seems like we should add some tests here for this scenario to our matrix to be sure. |
Hello @michael-hawker, In immediate mode, it never fires again after the first time. I am developing for UWP (min version 18362, target version 22000) but I can confirm that |
I'm surprised Is there value in these if |
I think the feature should continue to work regardless of |
Hey @huynhsontung not sure why we didn't resolve or fix this. I had some other Debounce clean-up to do, so I have fixed this in #569 - there was some issues in one of the original tests, so maybe that's why I was confused here in the past. Feel free to take a look. I'll add a bit more to the new docs page and a test or custom |
Describe the bug
Debounce(immediate: true)
does not work with a default timer. When a timer is created,IsRepeating
is set to true by default. This breaks the logic of Debounce whenimmediate: true
. SettingIsRepeating
to false on the timer fixes this issue.Steps to reproduce
DispatcherQueueTimer
usingDispatcherQueue.GetForCurrentThread().CreateTimer()
Debounce()
on that timer withimmediate: true
Expected behavior
Subsequent actions should trigger once the timer expires just like without the
immediate
flag.Windows Build Number
App minimum and target SDK version
Visual Studio Version
2022
Help us help you
Yes, I'd like to be assigned to work on this item.
The text was updated successfully, but these errors were encountered: