Fixes for tests
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
let imageUrl = $state<string | null>(null);
|
||||
let loading = $state(true);
|
||||
let error = $state(false);
|
||||
let lastLoadKey = "";
|
||||
|
||||
async function loadImage() {
|
||||
if (!itemId) {
|
||||
@@ -68,10 +69,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Reload image when props change
|
||||
// Only reload when the image identity changes (not on parent re-renders)
|
||||
$effect(() => {
|
||||
imageUrl = null;
|
||||
loadImage();
|
||||
const loadKey = `${itemId}|${imageType}|${tag || ""}`;
|
||||
if (loadKey !== lastLoadKey) {
|
||||
lastLoadKey = loadKey;
|
||||
imageUrl = null;
|
||||
loadImage();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user