Fixed: Using all movie genres for collection filters

pull/10743/head
Bogdan 4 weeks ago
parent 27dd8e8cd5
commit 62722d45b0

@ -91,12 +91,8 @@ export const defaultState = {
genres: function(item, filterValue, type) {
const predicate = filterTypePredicates[type];
let allGenres = [];
item.movies.forEach((movie) => {
allGenres = allGenres.concat(movie.genres);
});
const genres = Array.from(new Set(allGenres)).slice(0, 3);
const allGenres = item.movies.flatMap(({ genres }) => genres);
const genres = Array.from(new Set(allGenres));
return predicate(genres, filterValue);
},
@ -138,12 +134,8 @@ export const defaultState = {
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const genreList = items.reduce((acc, collection) => {
let collectionGenres = [];
collection.movies.forEach((movie) => {
collectionGenres = collectionGenres.concat(movie.genres);
});
const genres = Array.from(new Set(collectionGenres)).slice(0, 3);
const collectionGenres = collection.movies.flatMap(({ genres }) => genres);
const genres = Array.from(new Set(collectionGenres));
genres.forEach((genre) => {
acc.push({

Loading…
Cancel
Save