mirror of
https://github.com/immich-app/immich.git
synced 2025-06-03 21:54:21 -04:00
fix(web): asset grid with invalid asset id (at) (#12772)
fix(web): asset grid
This commit is contained in:
parent
65dcf9b655
commit
caa9b1a041
@ -638,9 +638,7 @@ export class AssetStore {
|
|||||||
this.options.userId ||
|
this.options.userId ||
|
||||||
this.options.personId ||
|
this.options.personId ||
|
||||||
this.options.albumId ||
|
this.options.albumId ||
|
||||||
isMismatched(this.options.isArchived, asset.isArchived) ||
|
this.isExcluded(asset)
|
||||||
isMismatched(this.options.isFavorite, asset.isFavorite) ||
|
|
||||||
isMismatched(this.options.isTrashed, asset.isTrashed)
|
|
||||||
) {
|
) {
|
||||||
// If asset is already in the bucket we don't need to recalculate
|
// If asset is already in the bucket we don't need to recalculate
|
||||||
// asset store containers
|
// asset store containers
|
||||||
@ -699,26 +697,22 @@ export class AssetStore {
|
|||||||
|
|
||||||
async findAndLoadBucketAsPending(id: string) {
|
async findAndLoadBucketAsPending(id: string) {
|
||||||
const bucketInfo = this.assetToBucket[id];
|
const bucketInfo = this.assetToBucket[id];
|
||||||
if (bucketInfo) {
|
let bucket: AssetBucket | null = bucketInfo?.bucket ?? null;
|
||||||
const bucket = bucketInfo.bucket;
|
if (!bucket) {
|
||||||
|
const asset = await getAssetInfo({ id });
|
||||||
|
if (!asset || this.isExcluded(asset)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bucket = await this.loadBucketAtTime(asset.localDateTime, { preventCancel: true, pending: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bucket && bucket.assets.some((a) => a.id === id)) {
|
||||||
this.pendingScrollBucket = bucket;
|
this.pendingScrollBucket = bucket;
|
||||||
this.pendingScrollAssetId = id;
|
this.pendingScrollAssetId = id;
|
||||||
this.emit(false);
|
this.emit(false);
|
||||||
return bucket;
|
return bucket;
|
||||||
}
|
}
|
||||||
const asset = await getAssetInfo({ id });
|
|
||||||
if (asset) {
|
|
||||||
if (this.options.isArchived !== asset.isArchived) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const bucket = await this.loadBucketAtTime(asset.localDateTime, { preventCancel: true, pending: true });
|
|
||||||
if (bucket) {
|
|
||||||
this.pendingScrollBucket = bucket;
|
|
||||||
this.pendingScrollAssetId = asset.id;
|
|
||||||
this.emit(false);
|
|
||||||
}
|
|
||||||
return bucket;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be paired with matching clearPendingScroll() call */
|
/* Must be paired with matching clearPendingScroll() call */
|
||||||
@ -905,6 +899,14 @@ export class AssetStore {
|
|||||||
}
|
}
|
||||||
this.store$.set(this);
|
this.store$.set(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isExcluded(asset: AssetResponseDto) {
|
||||||
|
return (
|
||||||
|
isMismatched(this.options.isArchived ?? false, asset.isArchived) ||
|
||||||
|
isMismatched(this.options.isFavorite, asset.isFavorite) ||
|
||||||
|
isMismatched(this.options.isTrashed ?? false, asset.isTrashed)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isSelectingAllAssets = writable(false);
|
export const isSelectingAllAssets = writable(false);
|
||||||
|
@ -18,8 +18,8 @@ export const assetFactory = Sync.makeFactory<AssetResponseDto>({
|
|||||||
localDateTime: Sync.each(() => faker.date.past().toISOString()),
|
localDateTime: Sync.each(() => faker.date.past().toISOString()),
|
||||||
updatedAt: Sync.each(() => faker.date.past().toISOString()),
|
updatedAt: Sync.each(() => faker.date.past().toISOString()),
|
||||||
isFavorite: Sync.each(() => faker.datatype.boolean()),
|
isFavorite: Sync.each(() => faker.datatype.boolean()),
|
||||||
isArchived: Sync.each(() => faker.datatype.boolean()),
|
isArchived: false,
|
||||||
isTrashed: Sync.each(() => faker.datatype.boolean()),
|
isTrashed: false,
|
||||||
duration: '0:00:00.00000',
|
duration: '0:00:00.00000',
|
||||||
checksum: Sync.each(() => faker.string.alphanumeric(28)),
|
checksum: Sync.each(() => faker.string.alphanumeric(28)),
|
||||||
isOffline: Sync.each(() => faker.datatype.boolean()),
|
isOffline: Sync.each(() => faker.datatype.boolean()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user