From 2332338ca17c116af1f14ae2a0cb414228322fd5 Mon Sep 17 00:00:00 2001 From: Frank Noirot Date: Thu, 23 Jan 2025 18:49:50 -0500 Subject: [PATCH] Show "No results found" for empty search results in command palette (#5143) --- src/components/CommandComboBox.tsx | 60 ++++++++++++++++-------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/components/CommandComboBox.tsx b/src/components/CommandComboBox.tsx index 725c1643e..568fb7949 100644 --- a/src/components/CommandComboBox.tsx +++ b/src/components/CommandComboBox.tsx @@ -75,34 +75,40 @@ function CommandComboBox({ autoFocus /> - - {filteredOptions?.map((option) => ( - - {'icon' in option && option.icon && ( - - )} -
-

- {option.displayName || option.name}{' '} -

- {option.description && ( -

- {option.description} -

+ {filteredOptions?.length ? ( + + {filteredOptions?.map((option) => ( + + {'icon' in option && option.icon && ( + )} -
-
- ))} -
+
+

+ {option.displayName || option.name}{' '} +

+ {option.description && ( +

+ {option.description} +

+ )} +
+ + ))} + + ) : ( +

+ No results found +

+ )} ) }