Sort series by name in filter builder

This commit is contained in:
Bogdan 2023-10-17 18:43:49 +03:00 committed by Mark McDowall
parent e9bb1d52a7
commit 6027041a4f
1 changed files with 4 additions and 6 deletions

View File

@ -2,18 +2,16 @@ import React from 'react';
import { useSelector } from 'react-redux';
import Series from 'Series/Series';
import createAllSeriesSelector from 'Store/Selectors/createAllSeriesSelector';
import sortByName from 'Utilities/Array/sortByName';
import FilterBuilderRowValue from './FilterBuilderRowValue';
import FilterBuilderRowValueProps from './FilterBuilderRowValueProps';
function SeriesFilterBuilderRowValue(props: FilterBuilderRowValueProps) {
const allSeries: Series[] = useSelector(createAllSeriesSelector());
const tagList = allSeries.map((series) => {
return {
id: series.id,
name: series.title,
};
});
const tagList = allSeries
.map((series) => ({ id: series.id, name: series.title }))
.sort(sortByName);
return <FilterBuilderRowValue {...props} tagList={tagList} />;
}