Skip to content

Commit a22306a

Browse files
committed
Use Query check instead of bool check
1 parent 893ec48 commit a22306a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: Flow.Launcher/ViewModel/MainViewModel.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public partial class MainViewModel : BaseModel, ISavable, IDisposable
3131

3232
private static readonly string ClassName = nameof(MainViewModel);
3333

34-
private bool _isQueryRunning;
3534
private Query _lastQuery;
35+
private Query _runningQuery;
3636
private string _queryTextBeforeLeaveResults;
3737

3838
private readonly FlowLauncherJsonStorage<History> _historyItemsStorage;
@@ -1216,7 +1216,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12161216
_updateToken = _updateSource.Token;
12171217

12181218
ProgressBarVisibility = Visibility.Hidden;
1219-
_isQueryRunning = true;
1219+
1220+
_runningQuery = query;
12201221

12211222
// Switch to ThreadPool thread
12221223
await TaskScheduler.Default;
@@ -1260,7 +1261,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12601261
_ = Task.Delay(200, _updateSource.Token).ContinueWith(_ =>
12611262
{
12621263
// start the progress bar if query takes more than 200 ms and this is the current running query and it didn't finish yet
1263-
if (_isQueryRunning)
1264+
if (_runningQuery != null && _runningQuery == query)
12641265
{
12651266
ProgressBarVisibility = Visibility.Visible;
12661267
}
@@ -1292,7 +1293,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12921293

12931294
// this should happen once after all queries are done so progress bar should continue
12941295
// until the end of all querying
1295-
_isQueryRunning = false;
1296+
_runningQuery = null;
1297+
12961298
if (!_updateSource.Token.IsCancellationRequested)
12971299
{
12981300
// update to hidden if this is still the current query

0 commit comments

Comments
 (0)