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:
Lukas 2025-11-07 21:22:02 +01:00 committed by GitHub
parent 93ab42fa24
commit c935ae47d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 0 deletions

View file

@ -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}

View file

@ -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">

View file

@ -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">

View file

@ -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