Преглед изворни кода

refactor(EditSongs): Move next song scrollIntoView to pickSong

Owen Diffey пре 3 година
родитељ
комит
5388dba687
1 измењених фајлова са 5 додато и 7 уклоњено
  1. 5 7
      frontend/src/components/modals/EditSongs.vue

+ 5 - 7
frontend/src/components/modals/EditSongs.vue

@@ -290,6 +290,11 @@ export default {
 				prefill: this.songPrefillData[song._id]
 			});
 			this.currentSong = song;
+			if (
+				this.$refs[`edit-songs-item-${song._id}`] &&
+				this.$refs[`edit-songs-item-${song._id}`][0]
+			)
+				this.$refs[`edit-songs-item-${song._id}`][0].scrollIntoView();
 		},
 		editNextSong() {
 			const currentlyEditingSongIndex = this.filteredEditingItemIndex;
@@ -308,13 +313,6 @@ export default {
 			if (newEditingSongIndex > -1) {
 				const nextSong = this.filteredItems[newEditingSongIndex].song;
 				this.pickSong(nextSong);
-				if (
-					this.$refs[`edit-songs-item-${nextSong._id}`] &&
-					this.$refs[`edit-songs-item-${nextSong._id}`][0]
-				)
-					this.$refs[
-						`edit-songs-item-${nextSong._id}`
-					][0].scrollIntoView();
 			}
 		},
 		toggleFlag(songIndex = null) {