Skip to content

Commit

Permalink
fix(web): update recent album after edit (#15762)
Browse files Browse the repository at this point in the history
* fix(web): update recent album after edit

* chore: clean up

---------

Co-authored-by: Jason Rasmussen <[email protected]>
  • Loading branch information
antoniosarro and jrasm91 authored Jan 29, 2025
1 parent b4a4abb commit f3ba994
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web/src/lib/components/album-page/albums-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand All @@ -308,6 +318,7 @@
});
updateAlbumInfo(album);
updateRecentAlbumInfo(album);
};
const handleAddUsers = async (albumUsers: AlbumUserAddDto[]) => {
Expand Down

0 comments on commit f3ba994

Please sign in to comment.