Skip to content

Commit

Permalink
Merge pull request CaramelFur#38 from kaiiiz/patch-dup-reqs
Browse files Browse the repository at this point in the history
Fix duplicate requests in picsur-img.component
  • Loading branch information
CaramelFur authored Mar 15, 2023
2 parents 10036f1 + 86737eb commit c65b7ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
<mat-spinner
(nguiInview)="onInview($event)"
(nguiOutview)="onOutview($event)"
*ngIf="state === 'loading'"
*ngIf="state === 'init' || state === 'loading'"
></mat-spinner>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Logger } from 'src/app/services/logger/logger.service';
import { QoiWorkerService } from 'src/app/workers/qoi-worker.service';

enum PicsurImgState {
Init = 'init',
Loading = 'loading',
Canvas = 'canvas',
Image = 'image',
Expand All @@ -39,7 +40,7 @@ export class PicsurImgComponent implements OnChanges {

@Input('src') imageURL: string | undefined;

public state: PicsurImgState = PicsurImgState.Loading;
public state: PicsurImgState = PicsurImgState.Init;

constructor(
private readonly qoiWorker: QoiWorkerService,
Expand Down Expand Up @@ -113,7 +114,8 @@ export class PicsurImgComponent implements OnChanges {
onInview(e: any) {
this.isInView = true;

if (this.state === PicsurImgState.Loading) {
if (this.state === PicsurImgState.Init) {
this.state = PicsurImgState.Loading;
this.reload();
}
}
Expand Down

0 comments on commit c65b7ca

Please sign in to comment.