mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[playlist] fix error when cloning a playlist and some songs are missing
This commit is contained in:
+9
-8
@@ -427,14 +427,15 @@ export const EditPlaylistModal: ModalComponent<BPList, Props> = ({ resolver, opt
|
||||
playlistAuthor: res.data.playlistAuthor,
|
||||
playlistTitle: res.data.playlistTitle,
|
||||
playlistDescription: res.data.playlistDescription,
|
||||
songs: Object.values(playlistMaps$.value ?? []).map(playlistMap => {
|
||||
const props = MapItemComponentPropsMapper.from(playlistMap.map);
|
||||
const playlistSong: PlaylistSong = {
|
||||
key: props.mapId,
|
||||
hash: props.hash,
|
||||
songName: props.title,
|
||||
difficulties: playlistMap.difficulties,
|
||||
}
|
||||
songs: Object.entries(playlistMaps$.value ?? []).map(([hash, playlistMap]) => {
|
||||
const props = playlistMap?.map ? MapItemComponentPropsMapper.from(playlistMap.map) : undefined;
|
||||
const playlistSong: PlaylistSong = {};
|
||||
|
||||
playlistSong.hash = props?.hash ?? hash;
|
||||
if(props?.mapId){ playlistSong.key = props.mapId; }
|
||||
if(props?.title){ playlistSong.songName = props.title; }
|
||||
if(playlistMap?.difficulties){ playlistSong.difficulties = playlistMap.difficulties; }
|
||||
|
||||
return playlistSong;
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user