Skip to content

Commit

Permalink
Refactor Optimize null filtering (#3323)
Browse files Browse the repository at this point in the history
Null was filtered twice.
  • Loading branch information
adamradocz committed Jul 24, 2022
1 parent c1b5ddc commit 03f4c95
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/ReactiveUI.Blazor/ReactiveComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected override void OnAfterRender(bool firstRender)
// The following subscriptions are here because if they are done in OnInitialized, they conflict with certain JavaScript frameworks.
var viewModelChanged =
this.WhenAnyValue(x => x.ViewModel)
.Where(x => x is not null)
.WhereNotNull()
.Publish()
.RefCount(2);

Expand All @@ -97,7 +97,6 @@ protected override void OnAfterRender(bool firstRender)
.DisposeWith(_compositeDisposable);

viewModelChanged
.WhereNotNull()
.Select(x =>
Observable
.FromEvent<PropertyChangedEventHandler?, Unit>(
Expand Down
3 changes: 1 addition & 2 deletions src/ReactiveUI.Blazor/ReactiveInjectableComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected override void OnAfterRender(bool firstRender)
// The following subscriptions are here because if they are done in OnInitialized, they conflict with certain JavaScript frameworks.
var viewModelChanged =
this.WhenAnyValue(x => x.ViewModel)
.Where(x => x is not null)
.WhereNotNull()
.Publish()
.RefCount(2);

Expand All @@ -97,7 +97,6 @@ protected override void OnAfterRender(bool firstRender)
.DisposeWith(_compositeDisposable);

viewModelChanged
.WhereNotNull()
.Select(x =>
Observable
.FromEvent<PropertyChangedEventHandler, Unit>(
Expand Down

0 comments on commit 03f4c95

Please sign in to comment.