Skip to content

Commit e662a1b

Browse files
committed
Improve code quality
1 parent 131d1ec commit e662a1b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public void RegisterResultsUpdatedEvent()
255255
else
256256
{
257257
// make a clone to avoid possible issue that plugin will also change the list and items when updating view model
258-
resultsCopy = DeepClone(e.Results, token);
258+
resultsCopy = DeepCloneResults(e.Results, token);
259259
}
260260

261261
foreach (var result in resultsCopy)
@@ -497,7 +497,7 @@ private async Task OpenResultAsync(string index)
497497
}
498498
}
499499

500-
private static IReadOnlyList<Result> DeepClone(IReadOnlyList<Result> results, CancellationToken token = default)
500+
private static IReadOnlyList<Result> DeepCloneResults(IReadOnlyList<Result> results, CancellationToken token = default)
501501
{
502502
var resultsCopy = new List<Result>();
503503

@@ -515,7 +515,7 @@ private static IReadOnlyList<Result> DeepClone(IReadOnlyList<Result> results, Ca
515515
return resultsCopy;
516516
}
517517

518-
private static IReadOnlyList<QuickSwitchResult> DeepClone(IReadOnlyList<QuickSwitchResult> results, CancellationToken token = default)
518+
private static IReadOnlyList<QuickSwitchResult> DeepCloneResults(IReadOnlyList<QuickSwitchResult> results, CancellationToken token = default)
519519
{
520520
var resultsCopy = new List<QuickSwitchResult>();
521521

@@ -1428,7 +1428,7 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
14281428
else
14291429
{
14301430
// make a copy of results to avoid possible issue that FL changes some properties of the records, like score, etc.
1431-
resultsCopy = DeepClone(results, token);
1431+
resultsCopy = DeepCloneResults(results, token);
14321432
}
14331433

14341434
foreach (var result in resultsCopy)
@@ -1453,8 +1453,7 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
14531453
{
14541454
var results = await PluginManager.QueryForPluginAsync(plugin, query, token);
14551455

1456-
if (token.IsCancellationRequested)
1457-
return;
1456+
if (token.IsCancellationRequested) return;
14581457

14591458
IReadOnlyList<Result> resultsCopy;
14601459
if (results == null)
@@ -1464,7 +1463,7 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
14641463
else
14651464
{
14661465
// make a copy of results to avoid possible issue that FL changes some properties of the records, like score, etc.
1467-
resultsCopy = DeepClone(results, token);
1466+
resultsCopy = DeepCloneResults(results, token);
14681467
}
14691468

14701469
foreach (var result in resultsCopy)

0 commit comments

Comments
 (0)