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

[Trivial] Simplify member access #12293

Merged
merged 3 commits into from
Feb 2, 2024
Merged

Conversation

yahiheb
Copy link
Collaborator

@yahiheb yahiheb commented Jan 21, 2024

No description provided.

@@ -30,7 +30,7 @@ public static void ShowFlyout(Control target, FlyoutBase flyout, IObservable<boo
{
condition = condition.CombineLatest(
window
.Select(window => window?.GetObservable(Window.IsActiveProperty) ?? Observable.Return(false))
.Select(window => window?.GetObservable(WindowBase.IsActiveProperty) ?? Observable.Return(false))
Copy link
Collaborator

@turbolay turbolay Jan 21, 2024

Choose a reason for hiding this comment

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

The change is correct, but this code is really weird because window hides another parameter named window in a wider scope. For me what would be correct is this:

Suggested change
.Select(window => window?.GetObservable(WindowBase.IsActiveProperty) ?? Observable.Return(false))
.Select(x => x.GetObservable(WindowBase.IsActiveProperty))

Same line 20:

window
			.Select(x => Observable.FromEventPattern<PixelPointEventArgs>(
					handler => x.PositionChanged += handler,
					handler => x.PositionChanged -= handler))

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no idea if this change is correct or not. @soosr can you check it please?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yahiheb if you revert this controversial change I will merge the rest. You can add comment to suspend if this causing warning at the compiler.

Copy link
Collaborator

@turbolay turbolay Jan 25, 2024

Choose a reason for hiding this comment

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

How is this change controversial? It is not. I'm simply saying that the rest of the function is wrong as well. I approved the PR btw

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is controversial as Clement said. In both cases the WindowBase.IsActiveProperty field is called.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The suggested modifications here https://github.com/zkSNACKs/WalletWasabi/pull/12293/files#r1461175589 both make sense

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I applied Clement's suggestions: 17d72b7

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have two suggestions for how to simplify the merging of these PRs with less risk in the future.

  • First idea: if the PR is [Trivial] just format, typo, taking compiler suggestion, renaming, etc, we should not mix refactorings into it. Even if something is found to be useful it must be done in an upcoming PR.
  • Second, if a question/comment pops up at any of the modifications the author of the PR facilitates the conversation by using git blame at the specific line. This way we can reduce the number of ppl getting involved.
  1. Do not mix!
  2. Use git blame

@yahiheb are you familiar with git blame?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes ofc

adamPetho
adamPetho previously approved these changes Jan 22, 2024
Copy link
Collaborator

@adamPetho adamPetho left a comment

Choose a reason for hiding this comment

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

LGTM, apart from FlyoutHelpers.cs, which I'm not sure about.

@@ -30,7 +30,7 @@ public static void ShowFlyout(Control target, FlyoutBase flyout, IObservable<boo
{
condition = condition.CombineLatest(
window
.Select(window => window?.GetObservable(Window.IsActiveProperty) ?? Observable.Return(false))
.Select(window => window?.GetObservable(WindowBase.IsActiveProperty) ?? Observable.Return(false))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no idea if this change is correct or not. @soosr can you check it please?

@@ -30,7 +30,7 @@ public static void ShowFlyout(Control target, FlyoutBase flyout, IObservable<boo
{
condition = condition.CombineLatest(
window
.Select(window => window?.GetObservable(Window.IsActiveProperty) ?? Observable.Return(false))
.Select(window => window?.GetObservable(WindowBase.IsActiveProperty) ?? Observable.Return(false))
Copy link
Collaborator

Choose a reason for hiding this comment

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

@yahiheb if you revert this controversial change I will merge the rest. You can add comment to suspend if this causing warning at the compiler.

@molnard
Copy link
Collaborator

molnard commented Feb 2, 2024

@yahiheb What's up with this?

@yahiheb
Copy link
Collaborator Author

yahiheb commented Feb 2, 2024

@yahiheb What's up with this?

As Clement has pointed out twice the change is correct. His comment was about the rest of the code, not what I have changed in this PR.
#12293 (comment)
#12293 (comment)

And as I have stated the same WindowBase.IsActiveProperty field is called with the previous code or with the new one.

@molnard
Copy link
Collaborator

molnard commented Feb 2, 2024

I thought you would get @soosr or someone from the UI to check this line and clarify the issue that was brought up. Or we don't care with that?

@yahiheb yahiheb requested a review from soosr February 2, 2024 13:55
@soosr soosr merged commit adf556a into WalletWasabi:master Feb 2, 2024
4 of 7 checks passed
@yahiheb yahiheb deleted the member-access branch February 2, 2024 17:55
@yahiheb yahiheb mentioned this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants