fix(web): prevent fetching asset info twice (#8486)

This commit is contained in:
Michel Heusschen 2024-04-04 03:20:54 +02:00 committed by GitHub
parent 0529076ed7
commit 66650f5944
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 47 additions and 61 deletions

View file

@ -1,16 +1,18 @@
import type { AssetResponseDto } from '@immich/sdk';
export class SlideshowHistory {
private history: string[] = [];
private history: AssetResponseDto[] = [];
private index = 0;
constructor(private onChange: (assetId: string) => void) {}
constructor(private onChange: (asset: AssetResponseDto) => void) {}
reset() {
this.history = [];
this.index = 0;
}
queue(assetId: string) {
this.history.push(assetId);
queue(asset: AssetResponseDto) {
this.history.push(asset);
// If we were at the end of the slideshow history, move the index to the new end
if (this.index === this.history.length - 2) {