Skip to content

Commit 9a7c08b

Browse files
committed
Revert fix in MainViewModel & Fix possible issue in WebSearch plugin
1 parent 0c43ea9 commit 9a7c08b

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,35 +1447,26 @@ public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates)
14471447
}
14481448
#endif
14491449

1450-
try
1450+
foreach (var metaResults in resultsForUpdates)
14511451
{
1452-
foreach (var metaResults in resultsForUpdates)
1452+
foreach (var result in metaResults.Results)
14531453
{
1454-
foreach (var result in metaResults.Results)
1454+
if (_topMostRecord.IsTopMost(result))
14551455
{
1456-
if (_topMostRecord.IsTopMost(result))
1457-
{
1458-
result.Score = int.MaxValue;
1459-
}
1460-
else
1461-
{
1462-
var priorityScore = metaResults.Metadata.Priority * 150;
1463-
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore;
1464-
}
1456+
result.Score = int.MaxValue;
1457+
}
1458+
else
1459+
{
1460+
var priorityScore = metaResults.Metadata.Priority * 150;
1461+
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore;
14651462
}
14661463
}
1464+
}
14671465

1468-
// it should be the same for all results
1469-
bool reSelect = resultsForUpdates.First().ReSelectFirstResult;
1466+
// it should be the same for all results
1467+
bool reSelect = resultsForUpdates.First().ReSelectFirstResult;
14701468

1471-
Results.AddResults(resultsForUpdates, token, reSelect);
1472-
}
1473-
catch (InvalidOperationException e)
1474-
{
1475-
// Plugin with IResultUpdate interface can somtimes throw this exception
1476-
// Collection was modified; enumeration operation may not execute
1477-
Log.Exception($"{nameof(MainViewModel)}.{nameof(UpdateResultView)}|UpdateResultView failed", e);
1478-
}
1469+
Results.AddResults(resultsForUpdates, token, reSelect);
14791470
}
14801471

14811472
#endregion

Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
8585

8686
ResultsUpdated?.Invoke(this, new ResultUpdatedEventArgs
8787
{
88-
Results = results,
88+
Results = results.ToList(),
8989
Query = query
9090
});
9191

0 commit comments

Comments
 (0)