mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: lazy load thumbnails on people and place list (#23682)
perf(web): lazy load thumbnails on people and place list
This commit is contained in:
parent
93ab42fa24
commit
c935ae47d0
4 changed files with 6 additions and 0 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
hiddenIconClass?: string;
|
hiddenIconClass?: string;
|
||||||
class?: ClassValue;
|
class?: ClassValue;
|
||||||
brokenAssetClass?: ClassValue;
|
brokenAssetClass?: ClassValue;
|
||||||
|
preload?: boolean;
|
||||||
onComplete?: ((errored: boolean) => void) | undefined;
|
onComplete?: ((errored: boolean) => void) | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,6 +39,7 @@
|
||||||
onComplete = undefined,
|
onComplete = undefined,
|
||||||
class: imageClass = '',
|
class: imageClass = '',
|
||||||
brokenAssetClass = '',
|
brokenAssetClass = '',
|
||||||
|
preload = true,
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
let loaded = $state(false);
|
let loaded = $state(false);
|
||||||
|
|
@ -92,6 +94,7 @@
|
||||||
{title}
|
{title}
|
||||||
class={['object-cover', optionalClasses, imageClass]}
|
class={['object-cover', optionalClasses, imageClass]}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
|
loading={preload ? 'eager' : 'lazy'}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,7 @@
|
||||||
altText={person.name}
|
altText={person.name}
|
||||||
widthStyle="100%"
|
widthStyle="100%"
|
||||||
hiddenIconClass="text-white group-hover:text-black transition-colors"
|
hiddenIconClass="text-white group-hover:text-black transition-colors"
|
||||||
|
preload={false}
|
||||||
/>
|
/>
|
||||||
{#if person.name}
|
{#if person.name}
|
||||||
<span class="absolute bottom-2 start-0 w-full select-text px-1 text-center font-medium text-white">
|
<span class="absolute bottom-2 start-0 w-full select-text px-1 text-center font-medium text-white">
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@
|
||||||
title={person.name}
|
title={person.name}
|
||||||
widthStyle="100%"
|
widthStyle="100%"
|
||||||
circle
|
circle
|
||||||
|
preload={false}
|
||||||
/>
|
/>
|
||||||
{#if person.isFavorite}
|
{#if person.isFavorite}
|
||||||
<div class="absolute top-4 start-4">
|
<div class="absolute top-4 start-4">
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@
|
||||||
src={getAssetThumbnailUrl({ id: item.id, size: AssetMediaSize.Thumbnail })}
|
src={getAssetThumbnailUrl({ id: item.id, size: AssetMediaSize.Thumbnail })}
|
||||||
alt={city}
|
alt={city}
|
||||||
class="object-cover w-39 h-39"
|
class="object-cover w-39 h-39"
|
||||||
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue