Skip to content

Commit e1279c9

Browse files
committed
fix(web): update recent album after edit
1 parent cc0cbd7 commit e1279c9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: web/src/lib/components/album-page/albums-list.svelte

+11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
locale,
3636
type AlbumViewSettings,
3737
} from '$lib/stores/preferences.store';
38+
import { userInteraction } from '$lib/stores/user.svelte';
3839
import { goto } from '$app/navigation';
3940
import { AppRoute } from '$lib/constants';
4041
import { t } from 'svelte-i18n';
@@ -293,6 +294,15 @@
293294
sharedAlbums[sharedAlbums.findIndex(({ id }) => id === album.id)] = album;
294295
};
295296
297+
const updateRecentAlbumInfo = (album: AlbumResponseDto) => {
298+
if (userInteraction.recentAlbums) {
299+
const index = userInteraction.recentAlbums.findIndex((recentAlbum) => recentAlbum.id === album.id);
300+
if (index !== -1) {
301+
userInteraction.recentAlbums[index] = { ...userInteraction.recentAlbums[index], ...album };
302+
}
303+
}
304+
};
305+
296306
const successEditAlbumInfo = (album: AlbumResponseDto) => {
297307
albumToEdit = null;
298308
@@ -308,6 +318,7 @@
308318
});
309319
310320
updateAlbumInfo(album);
321+
updateRecentAlbumInfo(album);
311322
};
312323
313324
const handleAddUsers = async (albumUsers: AlbumUserAddDto[]) => {

0 commit comments

Comments
 (0)