-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adding ReactiveOwningComponentBase #4205
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
Adding ReactiveOwningComponentBase #4205
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces ReactiveOwningComponentBase<T> to ReactiveUI.Blazor, providing Blazor components with ownership-based dependency injection (via OwningComponentBase<T>) combined with ReactiveUI's view model binding and activation support. This addresses issue #3001 by filling a gap in the ReactiveUI.Blazor component hierarchy where no reactive base component existed for scenarios requiring scoped service ownership.
Key Changes:
- Adds new
ReactiveOwningComponentBase<T>class that extendsOwningComponentBase<T> - Implements
IViewFor<T>,INotifyPropertyChanged, andICanActivateinterfaces - Provides automatic
StateHasChangedcalls on view model property changes - Includes activation/deactivation lifecycle support for
IActivatableViewModel
| } | ||
|
|
||
| /// <summary> | ||
| /// Raises the <see cref="PropertyChanged"/> event. |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML documentation summary says "Raises the event" but all other reactive Blazor component base classes use "Invokes the property changed event." This should be updated for consistency:
/// <summary>
/// Invokes the property changed event.
/// </summary>| /// Raises the <see cref="PropertyChanged"/> event. | |
| /// Invokes the property changed event. |
- Use PropertyChangedEventHandler instead of PropertyChangedEventHandler? - Edit summary of OnPropertyChanged
|
The pr comments are ai generated so like the disposed one you highlighted it could just be redundant. |
|
Ah, got it — thanks! I’ve fixed some of them already and also made a few other changes, such as removing the |
What kind of change does this PR introduce?
This PR adds a
ReactiveOwningComponentBase<T>to the ReactiveUI.Blazor project, as requested in #3001.What is the current behavior?
There is currently no reactive base component that combines
OwningComponentBase<T>with ReactiveUI’sIViewFor<T>/ activation support inReactiveUI.Blazor.What is the new behavior?
Blazor components can derive from
ReactiveOwningComponentBase<T>to:OwningComponentBase<T>,ViewModelproperty,ICanActivate) and automatically callStateHasChangedonINotifyPropertyChangedchanges.What might this PR break?
No breaking changes are expected. The PR only introduces a new base class and does not modify existing public APIs or behavior.
Please check if the PR fulfills these requirements
Other information:
Fixes #3001.