diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index 95547d273..615729b61 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -29,6 +29,12 @@ namespace Flow.Launcher.Plugin /// public string RawQuery { get; internal init; } + /// + /// Determines whether the query was forced to execute again. + /// When this property is true, plugins handling this query should avoid serving cached results. + /// + public bool IsForced { get; internal set; } = false; + /// /// Search part of a query. /// This will not include action keyword if exclusive plugin gets it, otherwise it should be same as RawQuery. diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 8529df7b3..5d21341e3 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -512,7 +512,7 @@ namespace Flow.Launcher.ViewModel } else if (reQuery) { - Query(); + Query(reQuery: true); } QueryTextCursorMovedToEnd = true; }); @@ -612,11 +612,11 @@ namespace Flow.Launcher.ViewModel #region Query - public void Query() + public void Query(bool reQuery = false) { if (SelectedIsFromQueryResults()) { - QueryResults(); + QueryResults(reQuery); } else if (ContextMenuSelected()) { @@ -716,7 +716,7 @@ namespace Flow.Launcher.ViewModel private readonly IReadOnlyList _emptyResult = new List(); - private async void QueryResults() + private async void QueryResults(bool reQuery = false) { _updateSource?.Cancel(); @@ -747,6 +747,8 @@ namespace Flow.Launcher.ViewModel if (currentCancellationToken.IsCancellationRequested) return; + // Update the query's IsForced property to true if this is a re-query + query.IsForced = reQuery; // handle the exclusiveness of plugin using action keyword RemoveOldQueryResults(query);