Skip to content

Commit 021b451

Browse files
committed
Improve code comments & Move flag position
1 parent 3484d08 commit 021b451

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13751375
// nothing to do here
13761376
}
13771377

1378-
// If results are not cleared, we need to clear the results
1378+
// If QueryTaskAsync or QueryHistoryTask is not called which means that results are not cleared
1379+
// we need to clear the results
13791380
if (!resultsCleared) Results.Clear();
13801381

13811382
if (currentCancellationToken.IsCancellationRequested) return;
@@ -1441,14 +1442,13 @@ await PluginManager.QueryHomeForPluginAsync(plugin, query, token) :
14411442
var shouldClearExistingResults = ShouldClearExistingResults(query, currentIsHomeQuery);
14421443
_lastQuery = query;
14431444
_previousIsHomeQuery = currentIsHomeQuery;
1445+
resultsCleared = true;
14441446

14451447
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, plugin.Metadata, query,
14461448
token, reSelect, shouldClearExistingResults)))
14471449
{
14481450
App.API.LogError(ClassName, "Unable to add item to Result Update Queue");
14491451
}
1450-
1451-
resultsCleared = true;
14521452
}
14531453

14541454
void QueryHistoryTask(CancellationToken token)
@@ -1466,14 +1466,13 @@ void QueryHistoryTask(CancellationToken token)
14661466
var shouldClearExistingResults = ShouldClearExistingResults(query, currentIsHomeQuery);
14671467
_lastQuery = query;
14681468
_previousIsHomeQuery = currentIsHomeQuery;
1469+
resultsCleared = true;
14691470

14701471
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, _historyMetadata, query,
14711472
token, reSelect, shouldClearExistingResults)))
14721473
{
14731474
App.API.LogError(ClassName, "Unable to add item to Result Update Queue");
14741475
}
1475-
1476-
resultsCleared = true;
14771476
}
14781477
}
14791478

0 commit comments

Comments
 (0)