@@ -1247,19 +1247,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12471247
12481248 if ( query == null ) // shortcut expanded
12491249 {
1250- App . API . LogDebug ( ClassName , $ "Clear query results") ;
1251-
1252- // Hide and clear results again because running query may show and add some results
1253- Results . Visibility = Visibility . Collapsed ;
1254- Results . Clear ( ) ;
1255-
1256- // Reset plugin icon
1257- PluginIconPath = null ;
1258- PluginIconSource = null ;
1259- SearchIconVisibility = Visibility . Visible ;
1260-
1261- // Hide progress bar again because running query may set this to visible
1262- ProgressBarVisibility = Visibility . Hidden ;
1250+ ClearResults ( ) ;
12631251 return ;
12641252 }
12651253
@@ -1388,7 +1376,11 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13881376
13891377 // If QueryTaskAsync or QueryHistoryTask is not called which means that results are not cleared
13901378 // we need to clear the results
1391- if ( ! resultsCleared ) Results . Clear ( ) ;
1379+ if ( ! resultsCleared )
1380+ {
1381+ ClearResults ( ) ;
1382+ return ;
1383+ }
13921384
13931385 if ( currentCancellationToken . IsCancellationRequested ) return ;
13941386
@@ -1403,6 +1395,23 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
14031395 }
14041396
14051397 // Local function
1398+ void ClearResults ( )
1399+ {
1400+ App . API . LogDebug ( ClassName , $ "Clear query results") ;
1401+
1402+ // Hide and clear results again because running query may show and add some results
1403+ Results . Visibility = Visibility . Collapsed ;
1404+ Results . Clear ( ) ;
1405+
1406+ // Reset plugin icon
1407+ PluginIconPath = null ;
1408+ PluginIconSource = null ;
1409+ SearchIconVisibility = Visibility . Visible ;
1410+
1411+ // Hide progress bar again because running query may set this to visible
1412+ ProgressBarVisibility = Visibility . Hidden ;
1413+ }
1414+
14061415 async Task QueryTaskAsync ( PluginPair plugin , CancellationToken token )
14071416 {
14081417 App . API . LogDebug ( ClassName , $ "Wait for querying plugin <{ plugin . Metadata . Name } >") ;
0 commit comments