-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Prevent apps from appearing in top-level search when Installed apps extension is disabled #40132
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
base: main
Are you sure you want to change the base?
Prevent apps from appearing in top-level search when Installed apps extension is disabled #40132
Conversation
…xtension is disabled - Added `IsActive` property to `CommandProviderWrapper` to indicate whether the provider is both valid and enabled by the user in the settings. - Updated `MainListPage` to verify that the provider for `AllApps` is active before including apps in filtered results.
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.
You know what, I think this is probably okay
_filteredItems = commands.Concat(apps); | ||
_filteredItems = commands; | ||
|
||
if (_tlcManager.CommandProviders.Any(static t => t is { Id: AllAppsCommandProvider.WellKnownId, IsActive: true })) |
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.
UpdateSearchText
is a very hot path.
Is there any way we could compute this ahead of time, and only update the value when the settings change (or in Commands_CollectionChanged
? that actually might handle both the settings changing, or an extension being added/removed)
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.
.... I guess this isn't that hot though. You've already put it scoped such that we'll only compute this the first time the query looks for apps. Every character after that will skip this.
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs
Outdated
Show resolved
Hide resolved
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 prevents installed applications from appearing in the top-level search results when the Installed Apps extension is disabled.
- Defines a WellKnownId constant for the AllApps command provider
- Introduces an IsActive property in CommandProviderWrapper to flag valid and enabled providers
- Updates MainListPage to include app commands in search results only if the corresponding provider is active
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs | Replaces hardcoded "AllApps" with a WellKnownId constant |
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs | Adds a check for active AllApps provider before concatenating app commands into search results |
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandProviderWrapper.cs | Introduces and sets the IsActive property based on provider settings |
This should support all exts with fallback items |
There is other work in progress for that. Apps are a very special case in the codebase. |
…utomatically refresh search results when the flag changes This commit ensures the flag that controls showing apps in the top-level search is computed in advance, enabling the UI to refresh search results automatically when the flag changes. - `settings.SettingsChanged` now fires before `TopLevelCommandManager` reloads commands, ensuring consistency. - As a bonus, search results now automatically refresh when the extension is toggled on or off, unless "Go home when activated" is enabled.
Summary of the Pull Request
Prevents installed applications from appearing in the top-level search when Installed Apps extension is disabled.
Previously, application commands were still returned in the global search results even when the Installed Apps extension was turned off.
To match user expectations, the search now respects the extension’s enabled state.
IsActive
property toCommandProviderWrapper
to indicate whether the provider is both valid and enabled by the user in the settings.MainListPage
to verify that the provider forAllApps
is active before including apps in filtered results.PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Verified that the Installed app entries are shown in the top-level search only when the Installed apps extension is enabled. Verified that turning the Installed apps extension on or off has an immediate effect, and that the behavior persists after an application restart.