Skip to content

Commit ad1ec86

Browse files
committed
fix: only render thumbnail once loaded
1 parent d7f73a7 commit ad1ec86

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib/components/general/FicsitCard.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
let actionButtons: HTMLElement;
5353
5454
let imageLoaded = false;
55+
let thumbnailLoaded = false;
5556
</script>
5657

5758
<div
@@ -76,15 +77,18 @@
7677
{:else}
7778
<img
7879
class="logo absolute max-h-full min-h-full min-w-full max-w-full"
80+
class:invisible={!imageLoaded}
7981
src={renderedLogo}
8082
alt="{renderedName} Logo"
8183
on:load={() => (imageLoaded = true)} />
82-
{#if !imageLoaded}
84+
{#if !imageLoaded && thumbHashData}
8385
<img
8486
class="logo absolute max-h-full min-h-full min-w-full max-w-full bg-neutral-500"
87+
class:invisible={!thumbnailLoaded}
8588
src={thumbHashData}
8689
alt="{renderedName} Logo"
8790
width="100%"
91+
on:load={() => (thumbnailLoaded = true)}
8892
out:fade={{ duration: 200, delay: 100 }} />
8993
{/if}
9094
{/if}

0 commit comments

Comments
 (0)