mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
fix unexpected different token due to default
This commit is contained in:
parent
199aa75c58
commit
dea168924d
1 changed files with 12 additions and 8 deletions
|
|
@ -135,13 +135,17 @@ namespace Flow.Launcher.ViewModel
|
|||
var plugin = (IResultUpdated)pair.Plugin;
|
||||
plugin.ResultsUpdated += (s, e) =>
|
||||
{
|
||||
if (e.Query.RawQuery == QueryText && !e.Token.IsCancellationRequested)
|
||||
if (e.Query.RawQuery != QueryText || e.Token.IsCancellationRequested)
|
||||
{
|
||||
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
|
||||
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, e.Token)))
|
||||
{
|
||||
Log.Error("MainViewModel", "Unable to add item to Result Update Queue");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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, token)))
|
||||
{
|
||||
Log.Error("MainViewModel", "Unable to add item to Result Update Queue");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -459,7 +463,7 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
private readonly IReadOnlyList<Result> _emptyResult = new List<Result>();
|
||||
|
||||
|
||||
private async void QueryResults()
|
||||
{
|
||||
_updateSource?.Cancel();
|
||||
|
|
@ -553,7 +557,7 @@ namespace Flow.Launcher.ViewModel
|
|||
await Task.Yield();
|
||||
|
||||
IReadOnlyList<Result> results = await PluginManager.QueryForPluginAsync(plugin, query, currentCancellationToken);
|
||||
|
||||
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
results ??= _emptyResult;
|
||||
|
|
|
|||
Loading…
Reference in a new issue