0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-11 02:23:09 -05:00

fix(web): update recent album after edit (#15762)

* fix(web): update recent album after edit

* chore: clean up

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Antonio Sarro 2025-01-29 18:27:30 +01:00 committed by GitHub
parent b4a4abbf51
commit f3ba994186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,6 +35,7 @@
locale,
type AlbumViewSettings,
} from '$lib/stores/preferences.store';
import { userInteraction } from '$lib/stores/user.svelte';
import { goto } from '$app/navigation';
import { AppRoute } from '$lib/constants';
import { t } from 'svelte-i18n';
@ -293,6 +294,15 @@
sharedAlbums[sharedAlbums.findIndex(({ id }) => id === album.id)] = album;
};
const updateRecentAlbumInfo = (album: AlbumResponseDto) => {
for (const cachedAlbum of userInteraction.recentAlbums || []) {
if (cachedAlbum.id === album.id) {
Object.assign(cachedAlbum, { ...cachedAlbum, ...album });
break;
}
}
};
const successEditAlbumInfo = (album: AlbumResponseDto) => {
albumToEdit = null;
@ -308,6 +318,7 @@
});
updateAlbumInfo(album);
updateRecentAlbumInfo(album);
};
const handleAddUsers = async (albumUsers: AlbumUserAddDto[]) => {