Skip to content

Add AlsoNotify support to ReactiveAttribute and generator#354

Merged
ChrisPulman merged 4 commits intomainfrom
AddAlsoNotifyToReactiveAttribute
Dec 24, 2025
Merged

Add AlsoNotify support to ReactiveAttribute and generator#354
ChrisPulman merged 4 commits intomainfrom
AddAlsoNotifyToReactiveAttribute

Conversation

@ChrisPulman
Copy link
Member

What kind of change does this PR introduce?

feature

What is the current behavior?

Unable to include other related properties for change notifications

What is the new behavior?

Introduces the AlsoNotify parameter to the ReactiveAttribute, allowing additional property change notifications to be specified.

Updates the source generator to handle AlsoNotify, emitting RaisePropertyChanged calls for the specified properties in generated setters.

Includes new and updated tests to verify the new behavior, and updates documentation to describe the new feature.

What might this PR break?

New feature

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)

Other information:

Introduces the AlsoNotify parameter to the ReactiveAttribute, allowing additional property change notifications to be specified. Updates the source generator to handle AlsoNotify, emitting RaisePropertyChanged calls for the specified properties in generated setters. Includes new and updated tests to verify the new behavior, and updates documentation to describe the new feature.
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

❌ Patch coverage is 55.10204% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.07%. Comparing base (f8a5eca) to head (37a422f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ators.Roslyn/Reactive/ReactiveGenerator.Execute.cs 33.33% 20 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
+ Coverage   42.86%   43.07%   +0.20%     
==========================================
  Files          64       64              
  Lines        3583     3626      +43     
  Branches      404      411       +7     
==========================================
+ Hits         1536     1562      +26     
- Misses       1935     1949      +14     
- Partials      112      115       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a 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 adds AlsoNotify support to the ReactiveAttribute, enabling developers to specify additional properties that should receive change notifications when a reactive property changes. The implementation updates the source generator to handle the new parameter and emit additional RaisePropertyChanged calls in generated property setters.

Key Changes:

  • Added constructor and AlsoNotify property to ReactiveAttribute for specifying additional notification targets
  • Updated generator to parse and filter AlsoNotify parameters, excluding empty/null values and self-references
  • Modified property generation templates to include additional RaisePropertyChanged calls in setters

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 27 comments.

Show a summary per file
File Description
src/ReactiveUI.SourceGenerators.Roslyn/AttributeDefinitions.cs Adds constructor and AlsoNotify property to ReactiveAttribute for both property and field target variants
src/ReactiveUI.SourceGenerators.Roslyn/Reactive/ReactiveGenerator.Execute.cs Implements AlsoNotify parsing logic and updates property generation templates to include additional notification calls
src/ReactiveUI.SourceGenerators.Roslyn/Reactive/Models/PropertyInfo.cs Adds AlsoNotify parameter to PropertyInfo record to store notification targets
src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs Demonstrates AlsoNotify usage with multiple property notifications
src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs Adds test case for AlsoNotify feature verification
src/ReactiveUI.SourceGenerator.Tests/REACTIVE/*.verified.cs Updates all verified test outputs to reflect new setter format with block syntax instead of expression syntax
README.md Documents new AlsoNotify feature with usage example

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Removed trailing whitespace in generated property setters across multiple test verification files. Refactored AlsoNotify property handling in the source generator to filter and add valid property names more efficiently, and simplified the code for generating AlsoNotify attributes. Updated a test summary for clarity.
Corrected 'decalaration' to 'declaration' in two instances to improve documentation accuracy.
Corrected '</sumary>' to '</summary>' in the XML documentation comments for the Inheritance property in ReactiveAttribute. Updated both the source and generated test files for consistency.
@ChrisPulman ChrisPulman merged commit b022d99 into main Dec 24, 2025
6 checks passed
@ChrisPulman ChrisPulman deleted the AddAlsoNotifyToReactiveAttribute branch December 24, 2025 16:37
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

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 Jan 8, 2026
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.

1 participant