Enhancement: optimize tasks / stats reload (#7402)

This commit is contained in:
shamoon
2024-08-05 23:25:55 -07:00
committed by GitHub
parent 15554322dd
commit 8fa52046e4
5 changed files with 42 additions and 25 deletions

View File

@@ -39,6 +39,12 @@ describe('TasksService', () => {
expect(req.request.method).toEqual('GET')
})
it('does not call tasks api endpoint on reload if already loading', () => {
tasksService.loading = true
tasksService.reload()
httpTestingController.expectNone(`${environment.apiBaseUrl}tasks/`)
})
it('calls acknowledge_tasks api endpoint on dismiss and reloads', () => {
tasksService.dismissTasks(new Set([1, 2, 3]))
const req = httpTestingController.expectOne(

View File

@@ -50,6 +50,7 @@ export class TasksService {
constructor(private http: HttpClient) {}
public reload() {
if (this.loading) return
this.loading = true
this.http