Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jiripolasek
Copy link
Contributor

@jiripolasek jiripolasek commented Jun 19, 2025

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.

  • 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.

PR Checklist

  • Closes: Disabling 'Installed apps' extension still shows apps. #39937
  • 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: nothing to update
  • New binaries: none
  • Documentation updated: nothing to update

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.

…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.
@jiripolasek jiripolasek marked this pull request as ready for review June 19, 2025 11:18
@zadjii-msft zadjii-msft added the Product-Command Palette Refers to the Command Palette utility label Jun 19, 2025
Copy link
Member

@zadjii-msft zadjii-msft left a 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 }))
Copy link
Member

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)

Copy link
Member

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.

@yeelam-gordon yeelam-gordon requested review from moooyo and Copilot June 20, 2025 02:25
Copy link
Contributor

@Copilot 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 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

@yeelam-gordon yeelam-gordon requested a review from lei9444 June 20, 2025 02:26
@htcfreek
Copy link
Collaborator

This should support all exts with fallback items

@zadjii-msft
Copy link
Member

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.
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.

3 participants