Skip to content

Commit

Permalink
perf: ⚡ do not re-create background fetches when searching for project
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed May 17, 2023
1 parent 086bf25 commit 864092b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/TogglTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,19 @@ internal async ValueTask<List<Result>> RequestStartEntry(CancellationToken token
return this.NotifyUnknownError();
}

if (this._selectedProjectId == -1 || query.SearchTerms.Length == 1)
if (query.SearchTerms.Length == 1)
{
this._selectedProjectId = -1;

// Start fetch for time entries asynchronously in the backgroundd
// Start fetch for time entries asynchronously in the background
_ = Task.Run(() =>
{
_ = this._GetTimeEntries(true);
});
}

if (this._selectedProjectId == -1)
{
var projects = new List<Result>
{
new Result
Expand Down

0 comments on commit 864092b

Please sign in to comment.