fix(web): updating asset store after remove (#7999)

This commit is contained in:
Michel Heusschen 2024-03-16 14:22:15 +01:00 committed by GitHub
parent 1d24e20d22
commit 321525ead5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -429,7 +429,6 @@ export class AssetStore {
removeAssets(ids: string[]) {
const idSet = new Set(ids);
this.assets = this.assets.filter((asset) => !idSet.has(asset.id));
// Iterate in reverse to allow array splicing.
for (let index = this.buckets.length - 1; index >= 0; index--) {
@ -441,16 +440,13 @@ export class AssetStore {
}
bucket.assets.splice(index_, 1);
bucket.bucketCount = bucket.assets.length;
if (bucket.bucketCount === 0) {
if (bucket.assets.length === 0) {
this.buckets.splice(index, 1);
}
delete this.assetToBucket[asset.id];
}
}
this.emit(false);
this.emit(true);
}
async getPreviousAssetId(assetId: string): Promise<string | null> {