Skip to content

Commit 00653a3

Browse files
committed
fix(dia-backend-asset-refreshing.service.ts): fix refresh not working when there's no Capture
1 parent 235e275 commit 00653a3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/app/shared/dia-backend/asset/refreshing/dia-backend-asset-refreshing.service.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { HttpErrorResponse } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
33
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
4-
import { EMPTY, forkJoin } from 'rxjs';
4+
import { EMPTY, forkJoin, of } from 'rxjs';
55
import { catchError, concatMap, first } from 'rxjs/operators';
66
import { HttpErrorCode } from '../../../error/error.service';
77
import { ProofRepository } from '../../../repositories/proof/proof-repository.service';
@@ -34,8 +34,9 @@ export class DiaBackendAsseRefreshingService {
3434
}
3535
return this.proofRepository.all$.pipe(
3636
first(),
37-
concatMap(proofs =>
38-
forkJoin(
37+
concatMap(proofs => {
38+
if (proofs.length === 0) return of([]);
39+
return forkJoin(
3940
proofs.map(proof =>
4041
this.assetRepository.fetchByProof$(proof).pipe(
4142
catchError((err: unknown) => {
@@ -49,8 +50,8 @@ export class DiaBackendAsseRefreshingService {
4950
})
5051
)
5152
)
52-
)
53-
),
53+
);
54+
}),
5455
concatMap(() => this.diaBackendAssetPrefetchingService.prefetch())
5556
);
5657
}

0 commit comments

Comments
 (0)