From 3feaee25e2781c01fc36eb98da2690034598634d Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 28 Feb 2023 02:47:01 +0200 Subject: [PATCH] Sort tags by label Co-authored-by: Mark McDowall (cherry picked from commit f32a3cd41c17bb9cb829ac24732cfeec6a18d569) Fixes #8531 --- frontend/src/Components/TagList.js | 14 ++++++-------- frontend/src/Movie/Details/MovieTagsConnector.js | 15 +++++---------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/frontend/src/Components/TagList.js b/frontend/src/Components/TagList.js index 485651bdc..6da96849c 100644 --- a/frontend/src/Components/TagList.js +++ b/frontend/src/Components/TagList.js @@ -1,4 +1,3 @@ -import _ from 'lodash'; import PropTypes from 'prop-types'; import React from 'react'; import { kinds } from 'Helpers/Props'; @@ -6,16 +5,15 @@ import Label from './Label'; import styles from './TagList.css'; function TagList({ tags, tagList }) { + const sortedTags = tags + .map((tagId) => tagList.find((tag) => tag.id === tagId)) + .filter((tag) => !!tag) + .sort((a, b) => a.label.localeCompare(b.label)); + return (
{ - tags.map((t) => { - const tag = _.find(tagList, { id: t }); - - if (!tag) { - return null; - } - + sortedTags.map((tag) => { return (