From 9bdaea4a1bf7c13d36db7deb33df0b11e4fea26a Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 19 May 2020 22:08:29 -0400 Subject: [PATCH] Fixed: Tag details list movies in alphabetical order Co-Authored-By: Mark McDowall --- .../TagDetailsModalContentConnector.js | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/frontend/src/Settings/Tags/Details/TagDetailsModalContentConnector.js b/frontend/src/Settings/Tags/Details/TagDetailsModalContentConnector.js index c0f500d2a..864d81a94 100644 --- a/frontend/src/Settings/Tags/Details/TagDetailsModalContentConnector.js +++ b/frontend/src/Settings/Tags/Details/TagDetailsModalContentConnector.js @@ -9,7 +9,7 @@ function findMatchingItems(ids, items) { }); } -function createMatchingMovieSelector() { +function createUnorderedMatchingMoviesSelector() { return createSelector( (state, { movieIds }) => movieIds, createAllMoviesSelector(), @@ -17,6 +17,26 @@ function createMatchingMovieSelector() { ); } +function createMatchingMoviesSelector() { + return createSelector( + createUnorderedMatchingMoviesSelector(), + (movies) => { + return movies.sort((movieA, movieB) => { + const sortTitleA = movieA.sortTitle; + const sortTitleB = movieB.sortTitle; + + if (sortTitleA > sortTitleB) { + return 1; + } else if (sortTitleA < sortTitleB) { + return -1; + } + + return 0; + }); + } + ); +} + function createMatchingDelayProfilesSelector() { return createSelector( (state, { delayProfileIds }) => delayProfileIds, @@ -51,7 +71,7 @@ function createMatchingNetImportsSelector() { function createMapStateToProps() { return createSelector( - createMatchingMovieSelector(), + createMatchingMoviesSelector(), createMatchingDelayProfilesSelector(), createMatchingNotificationsSelector(), createMatchingRestrictionsSelector(),