Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2385,19 +2385,23 @@ public async void Hide(bool reset = true)
switch (Settings.LastQueryMode)
{
case LastQueryMode.Empty:
await ChangeQueryTextAsync(string.Empty);
await ChangeQueryTextAsync(string.Empty, isReQuery: true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: In LastQueryMode.Empty (the default), this forces a fresh query on every Hide whenever the query text is already empty, since ChangeQueryTextAsync hits its isReQuery branch for an unchanged empty string. That means every dismissal of the launcher — including dismissals that never result in a reopen, dismissals right after executing a result (line 610), and plugin reloads (line 334) — now runs a full background search. Consider scoping the re-query (e.g., only when reopening on Show, or only when a stale-result condition holds) instead of unconditionally re-querying on every close.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Flow.Launcher/ViewModel/MainViewModel.cs, line 2388:

<comment>In LastQueryMode.Empty (the default), this forces a fresh query on every Hide whenever the query text is already empty, since ChangeQueryTextAsync hits its isReQuery branch for an unchanged empty string. That means every dismissal of the launcher — including dismissals that never result in a reopen, dismissals right after executing a result (line 610), and plugin reloads (line 334) — now runs a full background search. Consider scoping the re-query (e.g., only when reopening on Show, or only when a stale-result condition holds) instead of unconditionally re-querying on every close.</comment>

<file context>
@@ -2385,19 +2385,23 @@ public async void Hide(bool reset = true)
                 {
                     case LastQueryMode.Empty:
-                        await ChangeQueryTextAsync(string.Empty);
+                        await ChangeQueryTextAsync(string.Empty, isReQuery: true);
                         break;
                     case LastQueryMode.Preserved:
</file context>

break;
case LastQueryMode.Preserved:
case LastQueryMode.Selected:
LastQuerySelected = Settings.LastQueryMode == LastQueryMode.Preserved;
if (string.IsNullOrEmpty(QueryText))
{
await ChangeQueryTextAsync(string.Empty, isReQuery: true);
}
break;
case LastQueryMode.ActionKeywordPreserved:
case LastQueryMode.ActionKeywordSelected:
var newQuery = _lastQuery.ActionKeyword;

if (!string.IsNullOrEmpty(newQuery))
newQuery += " ";
await ChangeQueryTextAsync(newQuery);
await ChangeQueryTextAsync(newQuery, isReQuery: true);

if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected)
LastQuerySelected = false;
Expand Down
Loading