mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
fix: description does not rerender when navigating between assets (#25137)
This commit is contained in:
parent
fbd49e0b79
commit
109c79125d
1 changed files with 7 additions and 8 deletions
|
|
@ -13,17 +13,16 @@
|
||||||
|
|
||||||
let { asset, isOwner }: Props = $props();
|
let { asset, isOwner }: Props = $props();
|
||||||
|
|
||||||
let currentDescription = asset.exifInfo?.description ?? '';
|
let currentDescription = $derived(asset.exifInfo?.description ?? '');
|
||||||
let draftDescription = $state(currentDescription);
|
let description = $derived(currentDescription);
|
||||||
|
|
||||||
const handleFocusOut = async () => {
|
const handleFocusOut = async () => {
|
||||||
if (draftDescription === currentDescription) {
|
if (description === currentDescription) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await updateAsset({ id: asset.id, updateAssetDto: { description: draftDescription } });
|
await updateAsset({ id: asset.id, updateAssetDto: { description } });
|
||||||
toastManager.success($t('asset_description_updated'));
|
toastManager.success($t('asset_description_updated'));
|
||||||
currentDescription = draftDescription;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, $t('cannot_update_the_description'));
|
handleError(error, $t('cannot_update_the_description'));
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +32,7 @@
|
||||||
{#if isOwner}
|
{#if isOwner}
|
||||||
<section class="px-4 mt-10">
|
<section class="px-4 mt-10">
|
||||||
<Textarea
|
<Textarea
|
||||||
bind:value={draftDescription}
|
bind:value={description}
|
||||||
class="max-h-40 outline-none border-b border-gray-500 bg-transparent ring-0 focus:ring-0 resize-none focus:border-b-2 focus:border-immich-primary dark:focus:border-immich-dark-primary dark:bg-transparent"
|
class="max-h-40 outline-none border-b border-gray-500 bg-transparent ring-0 focus:ring-0 resize-none focus:border-b-2 focus:border-immich-primary dark:focus:border-immich-dark-primary dark:bg-transparent"
|
||||||
rows={1}
|
rows={1}
|
||||||
grow
|
grow
|
||||||
|
|
@ -47,8 +46,8 @@
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
{:else if draftDescription}
|
{:else if description}
|
||||||
<section class="px-4 mt-6">
|
<section class="px-4 mt-6">
|
||||||
<p class="wrap-break-word whitespace-pre-line w-full text-black dark:text-white text-base">{draftDescription}</p>
|
<p class="wrap-break-word whitespace-pre-line w-full text-black dark:text-white text-base">{description}</p>
|
||||||
</section>
|
</section>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue