From 693bae763138d6ea865f413a5eb7064423437f89 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 14 Oct 2025 20:47:57 +0800 Subject: [PATCH] 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. --- Flow.Launcher/ViewModel/MainViewModel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 846b46a43..ceced2d18 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -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);