Optimize query result selection handling

Refactored `QueryResultsSelected()` usage by introducing a local
variable `queryResultsSelected` to avoid redundant method calls,
improving efficiency and readability. Added a comment to clarify
the purpose of the variable. Updated conditional logic to use
the new variable instead of directly invoking the method.
This commit is contained in:
Jack251970 2025-10-14 20:47:57 +08:00
parent f6d5a27e0b
commit 693bae7631

View file

@ -491,6 +491,8 @@ namespace Flow.Launcher.ViewModel
[RelayCommand]
private async Task OpenResultAsync(string index)
{
// Must check query results selected before executing the action
var queryResultsSelected = QueryResultsSelected();
var results = SelectedResults;
if (index is not null)
{
@ -530,7 +532,7 @@ namespace Flow.Launcher.ViewModel
Hide();
}
}
if (QueryResultsSelected())
if (queryResultsSelected)
{
_userSelectedRecord.Add(result);
_history.Add(result);