Skip to content

Commit 9850e9d

Browse files
committed
Fix issue that plugin will cannot cache records
1 parent 2ffe170 commit 9850e9d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,9 +1196,18 @@ async Task QueryTask(PluginPair plugin, bool reSelect = true)
11961196

11971197
currentCancellationToken.ThrowIfCancellationRequested();
11981198

1199-
results ??= _emptyResult;
1199+
IReadOnlyList<Result> resultsCopy;
1200+
if (results == null)
1201+
{
1202+
resultsCopy = _emptyResult;
1203+
}
1204+
else
1205+
{
1206+
// make a copy of results to avoid possible issue that FL changes some properties of the records, like score, etc.
1207+
resultsCopy = DeepCloneResults(results);
1208+
}
12001209

1201-
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, plugin.Metadata, query,
1210+
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, plugin.Metadata, query,
12021211
currentCancellationToken, reSelect)))
12031212
{
12041213
Log.Error("MainViewModel", "Unable to add item to Result Update Queue");

0 commit comments

Comments
 (0)