Skip to content

Commit 1d6c4ce

Browse files
authored
AddResults & UpdateResults new param "reselect"
1 parent e722927 commit 1d6c4ce

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Flow.Launcher/ViewModel/ResultsViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,23 @@ public void AddResults(List<Result> newRawResults, string resultId)
147147
/// <summary>
148148
/// To avoid deadlock, this method should not called from main thread
149149
/// </summary>
150-
public void AddResults(IEnumerable<ResultsForUpdate> resultsForUpdates, CancellationToken token)
150+
public void AddResults(IEnumerable<ResultsForUpdate> resultsForUpdates, CancellationToken token, bool reselect = true)
151151
{
152152
var newResults = NewResults(resultsForUpdates);
153153

154154
if (token.IsCancellationRequested)
155155
return;
156156

157-
UpdateResults(newResults, token);
157+
UpdateResults(newResults, token, reselect);
158158
}
159159

160-
private void UpdateResults(List<ResultViewModel> newResults, CancellationToken token = default)
160+
private void UpdateResults(List<ResultViewModel> newResults, CancellationToken token = default, bool reselect = true)
161161
{
162162
lock (_collectionLock)
163163
{
164164
// update UI in one run, so it can avoid UI flickering
165165
Results.Update(newResults, token);
166-
if (Results.Any())
166+
if (reselect && Results.Any())
167167
SelectedItem = Results[0];
168168
}
169169

0 commit comments

Comments
 (0)