Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Fixed the debounce extension in order to update to the last action pa…#4294

Merged
5 commits merged into
CommunityToolkit:mainfrom
matheus-inacio:fix-debounce
Oct 7, 2021
Merged

Fixed the debounce extension in order to update to the last action pa…#4294
5 commits merged into
CommunityToolkit:mainfrom
matheus-inacio:fix-debounce

Conversation

@matheus-inacio

@matheus-inacio matheus-inacio commented Oct 2, 2021

Copy link
Copy Markdown

Fixes #4293

PR Type

What kind of change does this PR introduce?

Bugfix

What is the current behavior?

The debounce extension was incorrectly updating the action in the ConcurrentList.

According to documentation the value passed in the updateValueFactory function, of the AddOrUpdate method, is the current value in the dictionary.

https://docs.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentdictionary-2.addorupdate?view=net-5.0

image

Therefore the current behavior is maintaining the old action and not updating with the new passed action.

_debounceInstances.AddOrUpdate(timer, action, (k, v) => v);

What is the new behavior?

Changed so that the action in the _ debounceInstances Dictionary is updated with the latest version.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Contains NO breaking changes
  • Tests for the changes have been added
  • Header has been added to all new source files (run build/UpdateHeaders.bat)

Other information

PS: The debuonce extension is referenced in the CanvasPathGeometryPage class (although this changes does not seem to break it).

@ghost

ghost commented Oct 2, 2021

Copy link
Copy Markdown

Thanks matheus-inacio for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from Rosuavio, azchohfi and michael-hawker October 2, 2021 22:47
@ghost ghost added the bug 🐛 An unexpected issue that highlights incorrect behavior label Oct 2, 2021
@net-foundation-cla

net-foundation-cla Bot commented Oct 4, 2021

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@net-foundation-cla

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ matheus-inacio sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

@michael-hawker michael-hawker added this to the 7.1.1 milestone Oct 5, 2021
Comment thread UnitTests/UnitTests.UWP/Extensions/Test_DispatcherQueueTimerExtensions.cs Outdated
Comment thread UnitTests/UnitTests.UWP/Extensions/Test_DispatcherQueueTimerExtensions.cs Outdated
@ghost

ghost commented Oct 7, 2021

Copy link
Copy Markdown

Hello @michael-hawker!

Because this pull request has the auto merge :zap: label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.
@ghost ghost merged commit 84adf91 into CommunityToolkit:main Oct 7, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

auto merge ⚡ bug 🐛 An unexpected issue that highlights incorrect behavior extensions ⚡

3 participants