Skip to content

Conversation

@jiripolasek
Copy link
Collaborator

Summary of the Pull Request

This PR introduces a new method
bool SetProperty<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
on BaseObservable.

The method updates the backing field only when the new value differs from the current one and raises property change notifications only in that case.

Summary

  • Adds SetProperty<T> to BaseObservable to guard property change notifications behind an actual value change.
  • SDK API is not affected.
  • Prevents unnecessary notifications from leaving the extension boundary.
  • Reduces redundant updates and saves a few round-trips between COM objects and view models.
  • Improves overall efficiency without changing observable behavior for consumers.

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

- Adds `SetProperty<T>` method to `BaseObservable` to verify value change
before raising property change notification. This prevents unnecessary
event emissions from Extension SDK objects when values remain the same.
- Replaces direct `OnPropertyChanged` calls with `SetProperty<T>` across relevant objects.
- Fixes missing property notifications (e.g. CommandContextItem, ContentPage)
- Make Separator observable and allow it to propage notifications about changes to Title and Section properties.
@jiripolasek jiripolasek self-assigned this Jan 5, 2026
@jiripolasek jiripolasek added the Product-Command Palette Refers to the Command Palette utility label Jan 5, 2026
@niels9001 niels9001 requested a review from zadjii-msft January 8, 2026 10:46
@zadjii-msft zadjii-msft merged commit be90b58 into microsoft:main Jan 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants