Skip to content

Commit e17dbcd

Browse files
committed
Update NavigationToolbar.xaml.cs
1 parent 5133d15 commit e17dbcd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,17 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidCommand.GetLocalizedRes
317317
else if (mode == OmnibarSearchMode)
318318
{
319319
var shellPage = Ioc.Default.GetRequiredService<IContentPageContext>().ShellPage;
320+
320321
if (args.Item is SuggestionModel item && !string.IsNullOrWhiteSpace(item.ItemPath) && shellPage is not null)
321322
await NavigationHelpers.OpenPath(item.ItemPath, shellPage);
322323
else
323324
{
324-
ContentPageContext.ShellPage?.SubmitSearch(args.Text);
325-
ViewModel.SaveSearchQueryToList(args.Text);
325+
var searchQuery = args.Item is SuggestionModel x && !string.IsNullOrWhiteSpace(x.Name)
326+
? x.Name
327+
: args.Text;
328+
329+
shellPage?.SubmitSearch(searchQuery); // use the resolved shellPage for consistency
330+
ViewModel.SaveSearchQueryToList(searchQuery);
326331
}
327332
}
328333
}

0 commit comments

Comments
 (0)