1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-19 21:46:43 -04:00

Don't mutate state when sorting items

This commit is contained in:
ta264
2020-02-19 21:44:36 +00:00
committed by Mark McDowall
parent dd8d1b673e
commit 283f905d79
16 changed files with 52 additions and 48 deletions
@@ -4,15 +4,16 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import sortByName from 'Utilities/Array/sortByName';
import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector';
import SelectInput from './SelectInput';
function createMapStateToProps() {
return createSelector(
(state) => state.settings.qualityProfiles,
createSortedSectionSelector('settings.qualityProfiles', sortByName),
(state, { includeNoChange }) => includeNoChange,
(state, { includeMixed }) => includeMixed,
(qualityProfiles, includeNoChange, includeMixed) => {
const values = _.map(qualityProfiles.items.sort(sortByName), (qualityProfile) => {
const values = _.map(qualityProfiles.items, (qualityProfile) => {
return {
key: qualityProfile.id,
value: qualityProfile.name