Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CmdPal: Handle CommandItem Title changes properly and raise notification every time it changes#40513

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

jiripolasek
Copy link
Contributor

Summary of the Pull Request

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

… changesPreviously, the `Title` property raised a change notification only when set directly. However, the `Title` getter returns a coalesced value: if `Title` is not set, it falls back to `Command.Name`. This update ensures that property change notifications for `Title` are also raised when:- The `Command` property changes- The `Name` property of the assigned `Command` changes and affects the `Title`
…ing TitleCommandItemViewModel now updates its internal _itemTitle field not only when the CommandItem model raises a property notification for Title, but also when the model’s Command or the Command’s name changes.This works around an issue in SDK versions before 0.3, where CommandItem does not raise property change notifications for Title in all effective cases.This approach is not fully correct, as it relies on knowledge of CommandItem’s internal logic and the Title property being virtual and should be sooner or later reverted.
@jiripolasekjiripolasek changed the titleFeature/39167 cmdpal if you update the command after changing the title of a fallback item we won t hide it correctlyCmdPal: Handle CommandItem Title changes properly and raise notification every time it changesJul 9, 2025
@zadjii-msftzadjii-msft added the Product-Command PaletteRefers to the Command Palette utility labelJul 10, 2025
@michaeljolley
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jiripolasek
Copy link
ContributorAuthor

Hi, better to move this from the issue directly here:


I see a few possible solutions. I want to sync with you about the expected outcome, and discuss which parts we should keep and which are better reverted.

Current state + reasoning

  • CommandItem does not raise notification when itsTitle changes due to updates inCommand.Name or when theCommand is replaced.
  • We can't determine from outside ofCommandItem if it has explicit title or falls backCommand.Name.
  • CommandItem is part of the SDK, but each 3rd party extension has its own copy, so fix require every extension to update.
  • CommandItemViewModel caches the title, but we don't know what the source was.
  • TheCommandItemViewModel could work around the issue by watching for changes and updating its cache, but this breaks encapsulation and relies on knowledge on internals that might not hold (CommandItem.Title is virtual, subclass may add another reason for update).

Options

  • Option 1: Fix it in CommandItemViewModel.
    Watch for changes of Command or its properties and update _itemTitle. Quick fix for all extensions, but a workaround and not clean.

  • Option 2: Fix the root cause in CommandItem itself.
    Make it fulfill the INotifyPropChanged contract and notify of all Title change. We can update Title in Command setter + put weak event listener on its INPC. Clean, long-term solution, but slow to reach everyone because 3p extensions must update SDK.

  • Option 3: Do both: add the fix to CommandItem and a workaround in the CommandItemViewModel now; remove the workaround later.
    Immediate relief plus long-term solution, but some temporary code duplication.

…nd-after-changing-the-title-of-a-fallback-item-we-won-t-hide-it-correctly
@jiripolasekjiripolasek marked this pull request as ready for reviewJuly 16, 2025 16:44
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Product-Command PaletteRefers to the Command Palette utility
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@jiripolasek@michaeljolley@zadjii-msft

[8]ページ先頭

©2009-2025 Movatter.jp