From b2f7d34a4d8259576e339a0f81293dbe7eeed6f6 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Wed, 20 Mar 2024 12:26:39 -0500 Subject: [PATCH] fix weird issue --- Flow.Launcher/ViewModel/MainViewModel.cs | 10 +++++----- Flow.Launcher/ViewModel/ResultsForUpdate.cs | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 23e746bd7..46102ca92 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -223,7 +223,7 @@ namespace Flow.Launcher.ViewModel { if (SelectedIsFromQueryResults()) { - QueryResults(isReQuery: true, reselect: reselect); + QueryResults(isReQuery: true, reSelect: reselect); } } @@ -773,7 +773,7 @@ namespace Flow.Launcher.ViewModel private readonly IReadOnlyList _emptyResult = new List(); - private async void QueryResults(bool isReQuery = false, bool reselect = true) + private async void QueryResults(bool isReQuery = false, bool reSelect = true) { _updateSource?.Cancel(); @@ -848,7 +848,7 @@ namespace Flow.Launcher.ViewModel var tasks = plugins.Select(plugin => plugin.Metadata.Disabled switch { - false => QueryTask(plugin), + false => QueryTask(plugin, reSelect), true => Task.CompletedTask }).ToArray(); @@ -876,7 +876,7 @@ namespace Flow.Launcher.ViewModel } // Local function - async Task QueryTask(PluginPair plugin) + async Task QueryTask(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 @@ -890,7 +890,7 @@ namespace Flow.Launcher.ViewModel results ??= _emptyResult; if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, plugin.Metadata, query, - currentCancellationToken, reselect))) + currentCancellationToken, reSelect))) { Log.Error("MainViewModel", "Unable to add item to Result Update Queue"); } diff --git a/Flow.Launcher/ViewModel/ResultsForUpdate.cs b/Flow.Launcher/ViewModel/ResultsForUpdate.cs index c1daace56..bc0be0de8 100644 --- a/Flow.Launcher/ViewModel/ResultsForUpdate.cs +++ b/Flow.Launcher/ViewModel/ResultsForUpdate.cs @@ -12,7 +12,5 @@ namespace Flow.Launcher.ViewModel bool ReSelectFirstResult = true) { public string ID { get; } = Metadata.ID; - - public bool ReSelectFirstResult { get; set; } } }