We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14e6287 commit 348bfffCopy full SHA for 348bfff
packages/svelte/src/lib/UnLazyImage.svelte
@@ -1,5 +1,5 @@
1
<script lang="ts">
2
- import { onDestroy, onMount } from 'svelte'
+ import { onDestroy } from 'svelte'
3
import { lazyLoad } from 'unlazy'
4
5
/** Image source URL to be lazy-loaded. */
@@ -22,13 +22,8 @@
22
23
let target: HTMLImageElement | undefined
24
let cleanup: (() => void) | undefined
25
- let isMounted = false
26
27
- onMount(() => {
28
- isMounted = true
29
- })
30
-
31
- $: if (isMounted && target) {
+ $: if (target) {
32
cleanup?.()
33
34
cleanup = lazyLoad(target, {
0 commit comments