Replace for loop with find for QueueStatus

pull/5043/head
Qstick 4 years ago committed by GitHub
parent 9472af8f83
commit d6d740a0d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,16 +64,7 @@ function createMapStateToProps() {
); );
}); });
let queueStatus = null; const firstQueueItem = queueItems.find((q) => q.movieId === movie.id);
let queueState = null;
for (const q in queueItems) {
if (queueItems[q].movieId === movie.id) {
queueStatus = queueItems[q].status;
queueState = queueItems[q].trackedDownloadState;
break;
}
}
return { return {
...movie, ...movie,
@ -81,8 +72,8 @@ function createMapStateToProps() {
showSearchAction, showSearchAction,
isRefreshingMovie, isRefreshingMovie,
isSearchingMovie, isSearchingMovie,
queueStatus, queueStatus: firstQueueItem.status,
queueState queueState: firstQueueItem.trackedDownloadState
}; };
} }
); );

Loading…
Cancel
Save