fix(products): keep newly uploaded image when SSE list is stale

The live product stream was replacing the catalog with an older payload, so the new photo flashed then jumped back. Keep the newer file_id and stop resetting the img on unrelated price ticks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-25 16:14:49 +03:30
co-authored by Cursor
parent 16ade71598
commit 29579f80d3
3 changed files with 53 additions and 9 deletions
+14 -4
View File
@@ -29,16 +29,26 @@ const props = withDefaults(
}
)
function productImageKey(product?: ProductImageSource): string {
return [
product?.file_id ?? '',
product?.file?.id ?? '',
product?.file?.full_src ?? '',
product?.file?.src ?? '',
product?.file?.url ?? '',
product?.img ?? '',
].join('|')
}
const currentSrc = ref(resolveProductImageSrc(props.product))
const usingFallback = ref(false)
watch(
() => props.product,
(product) => {
() => productImageKey(props.product),
() => {
usingFallback.value = false
currentSrc.value = resolveProductImageSrc(product)
currentSrc.value = resolveProductImageSrc(props.product)
},
{ deep: true }
)
function handleError() {