Skip to content

Conversation

@WalkerCodeRanger
Copy link
Contributor

@WalkerCodeRanger WalkerCodeRanger commented May 6, 2020

What kind of change does this PR introduce?
Fixes #2382 DelayChangeNotifications does not delay PropertyChanged events

What is the current behavior?
Calling DelayChangeNotifications() on a ReactiveObject delays the Changing and Changed observable notifications, but not the actual PropertyChanging and PropertyChanged events.

What is the new behavior?
DelayChangeNotifications() now delays PropertyChanging and PropertyChanged events the same as the observables. Duplicate events are also removed the same as with the observables.

What might this PR break?
Code relying on the current behavior of PropertyChanging and PropertyChanged events not being delayed.

While I don't think this will break stuff, the most likely places for other bugs to be introduced:

  • Exception handling for exceptions thrown from PropertyChanging and PropertyChanged events
  • The ordering of change notifications in the Changing and Changed observables
  • The raising of PropertyChanging and PropertyChanged events

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
    • API docs for DelayChangeNotifications() was already not very specific, so didn't need to change.

Other Information:
The approach used here was discussed in issue #2382. See specifically my comment and those follow.

Jeff Walker added 2 commits May 4, 2020 17:22
Improve the test of deferring change notifications on reactive objects to test that "Changing" notifications are delayed in addition to "Changed" notifications. Also improved to verify which properties change notifications were sent.
…opertyChanged events

DelayChangeNotifications() delayed notifications through the Changing and Changed observables, but had no effect on the PropertyChanging and PropertyChanged events. This fixes that.
@WalkerCodeRanger WalkerCodeRanger requested a review from a team May 6, 2020 00:32
@dnfclas
Copy link

dnfclas commented May 6, 2020

CLA assistant check
All CLA requirements met.

IObservable<Exception> ThrownExceptions { get; }

/// <summary>
/// sdfsdg.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want a real comment here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely agree. That was an oversight on my part. Sorry about that. I'll fix this one and the other one below.

"StyleCop.CSharp.NamingRules",
"SA1300:Element should begin with upper-case letter",
Justification = "Event is private backing field for PropertyChanging")]
private event PropertyChangingEventHandler _propertyChanging;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to stick to the naming scheme regardless if it's private.

@glennawatson
Copy link
Contributor

I'll have a full review over the next hour or so. Thanks for submitting the pr

@glennawatson
Copy link
Contributor

Ok, tested your changes they look good. One you fix up those comments/style issues we are good to go :)

@WalkerCodeRanger
Copy link
Contributor Author

All the code review comments have been addressed.

@glennawatson glennawatson merged commit b5566ef into reactiveui:master May 7, 2020
@glennawatson
Copy link
Contributor

I'll push out a new version later today. Thanks again.

@WalkerCodeRanger
Copy link
Contributor Author

Great, thank you for being very responsive and helpful.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DelayChangeNotifications does not delay PropertyChanged events

3 participants