From a0495736f14678805481afd330129d907945da54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Fri, 11 Jul 2025 19:08:31 +0200 Subject: [PATCH] CmdPal: Hide Open URL fallback item when search query is empty or doesn't contain valid URL (#40514) ## Summary of the Pull Request Clears and hides fallback item for URL when query changes and URL is no longer a valid URL. Fixes the situation when the item remains visible in the list with generic text and pointing the last valid URL it was updated with. ## PR Checklist - [x] **Closes:** #40512 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** no new strings - [x] **Dev docs:** nothing to update - [x] **New binaries:** none - [x] **Documentation updated:** none ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed Entered URL to search field. Observed the Open URL item is present. Cleared URL. Observed that Open URL item is not present. --- .../ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs index c702990716..45a65f4902 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs @@ -32,6 +32,8 @@ internal sealed partial class FallbackOpenURLItem : FallbackCommandItem { if (!IsValidUrl(query)) { + _executeItem.Url = string.Empty; + _executeItem.Name = string.Empty; Title = string.Empty; Subtitle = string.Empty; return;