浏览代码

fix: GET_SONGS returns out of order array

Owen Diffey 2 年之前
父节点
当前提交
ba3e508b63
共有 1 个文件被更改,包括 8 次插入1 次删除
  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)
+										)
+									);
 								}
 							}
 						);