Przeglądaj źródła

fix: removed workaround, properly fixed issue with EditSong modal reopening when editing from ImportAlbum

Kristian Vos 2 lat temu
rodzic
commit
4ff1c44301

+ 7 - 10
frontend/src/components/modals/ImportAlbum.vue

@@ -329,7 +329,7 @@ export default {
 	},
 	watch: {
 		/* eslint-disable */
-		"modals.editSong": function(value) {
+		"modals.editSong": function (value) {
 			if (!value) this.editNextSong();
 		}
 		/* eslint-enable */
@@ -362,15 +362,12 @@ export default {
 		},
 		editNextSong() {
 			if (this.editingSongs) {
-				setTimeout(() => {
-					this.editSong({
-						_id: this.songsToEdit[this.currentEditSongIndex].songId,
-						discogs:
-							this.songsToEdit[this.currentEditSongIndex].discogs
-					});
-					this.currentEditSongIndex += 1;
-					this.openModal("editSong");
-				}, 500);
+				this.editSong({
+					_id: this.songsToEdit[this.currentEditSongIndex].songId,
+					discogs: this.songsToEdit[this.currentEditSongIndex].discogs
+				});
+				this.currentEditSongIndex += 1;
+				this.openModal("editSong");
 			}
 		},
 		log(evt) {

+ 4 - 1
frontend/src/pages/Admin/tabs/HiddenSongs.vue

@@ -113,7 +113,7 @@
 			</table>
 		</div>
 		<import-album v-if="modals.importAlbum" />
-		<edit-song v-if="modals.editSong" />
+		<edit-song v-if="modals.editSong" song-type="songs" :key="song._id" />
 		<request-song v-if="modals.requestSong" />
 		<floating-box
 			id="keyboardShortcutsHelper"
@@ -225,6 +225,9 @@ export default {
 		...mapState("admin/hiddenSongs", {
 			songs: state => state.songs
 		}),
+		...mapState("modals/editSong", {
+			song: state => state.song
+		}),
 		...mapGetters({
 			socket: "websockets/getSocket"
 		})

+ 4 - 1
frontend/src/pages/Admin/tabs/UnverifiedSongs.vue

@@ -127,7 +127,7 @@
 			</table>
 		</div>
 		<import-album v-if="modals.importAlbum" />
-		<edit-song v-if="modals.editSong" />
+		<edit-song v-if="modals.editSong" song-type="songs" :key="song._id" />
 		<request-song v-if="modals.requestSong" />
 		<floating-box
 			id="keyboardShortcutsHelper"
@@ -243,6 +243,9 @@ export default {
 		...mapState("admin/unverifiedSongs", {
 			songs: state => state.songs
 		}),
+		...mapState("modals/editSong", {
+			song: state => state.song
+		}),
 		...mapGetters({
 			socket: "websockets/getSocket"
 		})

+ 4 - 1
frontend/src/pages/Admin/tabs/VerifiedSongs.vue

@@ -158,7 +158,7 @@
 			</table>
 		</div>
 		<import-album v-if="modals.importAlbum" />
-		<edit-song v-if="modals.editSong" song-type="songs" />
+		<edit-song v-if="modals.editSong" song-type="songs" :key="song._id" />
 		<request-song v-if="modals.requestSong" />
 		<floating-box
 			id="keyboardShortcutsHelper"
@@ -375,6 +375,9 @@ export default {
 		...mapState("admin/verifiedSongs", {
 			songs: state => state.songs
 		}),
+		...mapState("modals/editSong", {
+			song: state => state.song
+		}),
 		...mapGetters({
 			socket: "websockets/getSocket"
 		})