Browse Source

fix: ImportAlbum updated songs didn't always update properly

Kristian Vos 3 years ago
parent
commit
2a959c14dc

+ 5 - 3
frontend/src/components/modals/ImportAlbum.vue

@@ -658,9 +658,11 @@ export default {
 		},
 		updateTrackSong(updatedSong) {
 			this.updatePlaylistSong(updatedSong);
-			this.trackSongs.forEach((song, index) => {
-				if (song[0]._id === updatedSong._id)
-					this.trackSongs[index][0] = updatedSong;
+			this.trackSongs.forEach((songs, indexA) => {
+				songs.forEach((song, indexB) => {
+					if (song._id === updatedSong._id)
+						this.trackSongs[indexA][indexB] = updatedSong;
+				});
 			});
 		},
 		...mapActions({

+ 4 - 0
frontend/src/store/modules/modals/importAlbum.js

@@ -71,6 +71,10 @@ export default {
 				if (song._id === updatedSong._id)
 					state.playlistSongs[index] = updatedSong;
 			});
+			state.originalPlaylistSongs.forEach((song, index) => {
+				if (song._id === updatedSong._id)
+					state.originalPlaylistSongs[index] = updatedSong;
+			});
 		}
 	}
 };