Feature(imagequeue): (hopefully) handle some edge cases correctly

This commit is contained in:
Pieter Vander Vennet 2025-04-07 04:11:16 +02:00
parent 6925b3d26e
commit aa373ee698
4 changed files with 21 additions and 6 deletions

View file

@ -2,7 +2,7 @@ import { IdbLocalStorage } from "../Web/IdbLocalStorage"
import { Store, UIEventSource } from "../UIEventSource"
export interface ImageUploadArguments {
readonly featureId: string,
featureId: string,
readonly author: string,
readonly blob: File,
readonly targetKey: string | undefined,
@ -43,4 +43,17 @@ export default class ImageUploadQueue {
this._imagesInQueue.ping()
}
applyRemapping(oldId: string, newId: string) {
let hasChange = false
for (const img of this._imagesInQueue.data) {
if (img.featureId === oldId) {
img.featureId = newId
hasChange = true
}
}
if (hasChange) {
this._imagesInQueue.ping()
}
}
}