Skip to content

Commit

Permalink
Fix plugin change the result when updating view model
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack251970 committed Dec 8, 2024
1 parent 30938f1 commit 26d97a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ private void RegisterResultsUpdatedEvent()

var token = e.Token == default ? _updateToken : e.Token;

PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(e.Results, pair.Metadata, e.Query,
// make a copy of results to avoid plugin change the result when updating view model
var resultsCopy = e.Results.ToList();

PluginManager.UpdatePluginMetadata(resultsCopy, pair.Metadata, e.Query);
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, pair.Metadata, e.Query,
token)))
{
Log.Error("MainViewModel", "Unable to add item to Result Update Queue");
Expand Down

0 comments on commit 26d97a2

Please sign in to comment.