mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(web): prevent duplicate time bucket loads (#8091)
This commit is contained in:
parent
ec9a6bca14
commit
048d437b0b
3 changed files with 53 additions and 20 deletions
|
|
@ -229,21 +229,21 @@ export class AssetStore {
|
|||
}
|
||||
|
||||
async loadBucket(bucketDate: string, position: BucketPosition): Promise<void> {
|
||||
const bucket = this.getBucketByDate(bucketDate);
|
||||
if (!bucket) {
|
||||
return;
|
||||
}
|
||||
|
||||
bucket.position = position;
|
||||
|
||||
if (bucket.cancelToken || bucket.assets.length > 0) {
|
||||
this.emit(false);
|
||||
return;
|
||||
}
|
||||
|
||||
bucket.cancelToken = new AbortController();
|
||||
|
||||
try {
|
||||
const bucket = this.getBucketByDate(bucketDate);
|
||||
if (!bucket) {
|
||||
return;
|
||||
}
|
||||
|
||||
bucket.position = position;
|
||||
|
||||
if (bucket.assets.length > 0) {
|
||||
this.emit(false);
|
||||
return;
|
||||
}
|
||||
|
||||
bucket.cancelToken = new AbortController();
|
||||
|
||||
const assets = await getTimeBucket(
|
||||
{
|
||||
...this.options,
|
||||
|
|
@ -278,6 +278,8 @@ export class AssetStore {
|
|||
this.emit(true);
|
||||
} catch (error) {
|
||||
handleError(error, 'Failed to load assets');
|
||||
} finally {
|
||||
bucket.cancelToken = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue