@@ -34,6 +34,7 @@ public partial class MainViewModel : BaseModel, ISavable, IDisposable
34
34
private bool _isQueryRunning ;
35
35
private Query _lastQuery ;
36
36
private string _queryTextBeforeLeaveResults ;
37
+ private string _ignoredQueryText = null ;
37
38
38
39
private readonly FlowLauncherJsonStorage < History > _historyItemsStorage ;
39
40
private readonly FlowLauncherJsonStorage < UserSelectedRecord > _userSelectedRecordStorage ;
@@ -730,6 +731,9 @@ private ResultsViewModel SelectedResults
730
731
if ( isReturningFromContextMenu )
731
732
{
732
733
_queryText = _queryTextBeforeLeaveResults ;
734
+ // When executing OnPropertyChanged, QueryTextBox_TextChanged1 and Query will be called
735
+ // So we need to ignore it so that we will not call Query again
736
+ _ignoredQueryText = _queryText ;
733
737
OnPropertyChanged ( nameof ( QueryText ) ) ;
734
738
QueryTextCursorMovedToEnd = true ;
735
739
}
@@ -1076,6 +1080,20 @@ private bool QueryResultsPreviewed()
1076
1080
1077
1081
public void Query ( bool searchDelay , bool isReQuery = false )
1078
1082
{
1083
+ if ( _ignoredQueryText != null )
1084
+ {
1085
+ if ( _ignoredQueryText == QueryText )
1086
+ {
1087
+ _ignoredQueryText = null ;
1088
+ return ;
1089
+ }
1090
+ else
1091
+ {
1092
+ // If _ignoredQueryText does not match current QueryText, we should still execute Query
1093
+ _ignoredQueryText = null ;
1094
+ }
1095
+ }
1096
+
1079
1097
if ( QueryResultsSelected ( ) )
1080
1098
{
1081
1099
_ = QueryResultsAsync ( searchDelay , isReQuery ) ;
0 commit comments