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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user