Skip to content

Commit 7c12956

Browse files
committed
Clear results when there are no update tasks
1 parent 8670461 commit 7c12956

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,19 +1245,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12451245

12461246
if (query == null) // shortcut expanded
12471247
{
1248-
App.API.LogDebug(ClassName, $"Clear query results");
1249-
1250-
// Hide and clear results again because running query may show and add some results
1251-
Results.Visibility = Visibility.Collapsed;
1252-
Results.Clear();
1253-
1254-
// Reset plugin icon
1255-
PluginIconPath = null;
1256-
PluginIconSource = null;
1257-
SearchIconVisibility = Visibility.Visible;
1258-
1259-
// Hide progress bar again because running query may set this to visible
1260-
ProgressBarVisibility = Visibility.Hidden;
1248+
ClearResults();
12611249
return;
12621250
}
12631251

@@ -1351,8 +1339,9 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13511339
{
13521340
if (ShouldClearExistingResultsForNonQuery(plugins))
13531341
{
1354-
Results.Clear();
1355-
App.API.LogDebug(ClassName, $"Existing results are cleared for non-query");
1342+
// No update tasks and just return
1343+
ClearResults();
1344+
return;
13561345
}
13571346

13581347
tasks = plugins.Select(plugin => plugin.Metadata.HomeDisabled switch
@@ -1405,6 +1394,23 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
14051394
}
14061395

14071396
// Local function
1397+
void ClearResults()
1398+
{
1399+
App.API.LogDebug(ClassName, $"Clear query results");
1400+
1401+
// Hide and clear results again because running query may show and add some results
1402+
Results.Visibility = Visibility.Collapsed;
1403+
Results.Clear();
1404+
1405+
// Reset plugin icon
1406+
PluginIconPath = null;
1407+
PluginIconSource = null;
1408+
SearchIconVisibility = Visibility.Visible;
1409+
1410+
// Hide progress bar again because running query may set this to visible
1411+
ProgressBarVisibility = Visibility.Hidden;
1412+
}
1413+
14081414
async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
14091415
{
14101416
App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>");

0 commit comments

Comments
 (0)