Explorar o código

fix: GET_SONGS returns out of order array

Owen Diffey %!s(int64=2) %!d(string=hai) anos
pai
achega
ba3e508b63
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      backend/logic/songs.js

+ 8 - 1
backend/logic/songs.js

@@ -207,7 +207,14 @@ class _SongsModule extends CoreClass {
 											youtubeVideoId: video._id
 										};
 									});
-									next(null, [...songs, ...youtubeVideos]);
+									next(
+										null,
+										payload.youtubeIds.map(
+											youtubeId =>
+												songs.find(song => song.youtubeId === youtubeId) ||
+												youtubeVideos.find(video => video.youtubeId === youtubeId)
+										)
+									);
 								}
 							}
 						);