diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 7e64c6a28..2673a92d1 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1204,16 +1204,20 @@ namespace Flow.Launcher.ViewModel } // Local function - async Task QueryTaskAsync(PluginPair plugin, bool reSelect = true) + async ValueTask QueryTaskAsync(PluginPair plugin, bool reSelect = true) { // Since it is wrapped within a ThreadPool Thread, the synchronous context is null // Task.Yield will force it to run in ThreadPool await Task.Yield(); + if (_updateSource.Token.IsCancellationRequested) + return; + IReadOnlyList results = await PluginManager.QueryForPluginAsync(plugin, query, _updateSource.Token); - _updateSource.Token.ThrowIfCancellationRequested(); + if (_updateSource.Token.IsCancellationRequested) + return; IReadOnlyList resultsCopy; if (results == null)