mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(web): fix stale album page load (#27825)
* invalidate album data on album update to fix stale page load * invalidate album data on album update to fix stale page load * factor out callback, make async and await invalidate * chore: formatting --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
+8
-2
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto, onNavigate } from '$app/navigation';
|
import { goto, invalidate, onNavigate } from '$app/navigation';
|
||||||
import { scrollMemoryClearer } from '$lib/actions/scroll-memory';
|
import { scrollMemoryClearer } from '$lib/actions/scroll-memory';
|
||||||
import AlbumDescription from './album-description.svelte';
|
import AlbumDescription from './album-description.svelte';
|
||||||
import AlbumMap from '$lib/components/album-page/album-map.svelte';
|
import AlbumMap from '$lib/components/album-page/album-map.svelte';
|
||||||
@@ -309,6 +309,12 @@
|
|||||||
album = { ...album, albumUsers };
|
album = { ...album, albumUsers };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onAlbumUpdate = async (newAlbum: AlbumResponseDto) => {
|
||||||
|
album = newAlbum;
|
||||||
|
|
||||||
|
await invalidate('album:data');
|
||||||
|
};
|
||||||
|
|
||||||
const { Cast } = $derived(getGlobalActions($t));
|
const { Cast } = $derived(getGlobalActions($t));
|
||||||
const { Share } = $derived(getAlbumActions($t, album));
|
const { Share } = $derived(getAlbumActions($t, album));
|
||||||
const { AddAssets, Upload } = $derived(getAlbumAssetsActions($t, album, timelineMultiSelectManager.assets));
|
const { AddAssets, Upload } = $derived(getAlbumAssetsActions($t, album, timelineMultiSelectManager.assets));
|
||||||
@@ -330,7 +336,7 @@
|
|||||||
{onAlbumShare}
|
{onAlbumShare}
|
||||||
{onAlbumUserUpdate}
|
{onAlbumUserUpdate}
|
||||||
onAlbumUserDelete={refreshAlbum}
|
onAlbumUserDelete={refreshAlbum}
|
||||||
onAlbumUpdate={(newAlbum) => (album = newAlbum)}
|
{onAlbumUpdate}
|
||||||
/>
|
/>
|
||||||
<CommandPaletteDefaultProvider name={$t('album')} actions={[AddAssets, Upload, Close]} />
|
<CommandPaletteDefaultProvider name={$t('album')} actions={[AddAssets, Upload, Close]} />
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ import { authenticate } from '$lib/utils/auth';
|
|||||||
import { getAlbumInfo } from '@immich/sdk';
|
import { getAlbumInfo } from '@immich/sdk';
|
||||||
import type { PageLoad } from './$types';
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
export const load = (async ({ params, url }) => {
|
export const load = (async ({ params, url, depends }) => {
|
||||||
await authenticate(url);
|
await authenticate(url);
|
||||||
|
|
||||||
|
depends('album:data');
|
||||||
|
|
||||||
const album = await getAlbumInfo({ id: params.albumId });
|
const album = await getAlbumInfo({ id: params.albumId });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user