Fixed: Spotify Playlist selection

This commit is contained in:
Bogdan 2024-02-11 06:04:57 +02:00
parent 59efffd40f
commit f1efd05207
1 changed files with 22 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import TableBody from 'Components/Table/TableBody';
import TableRow from 'Components/Table/TableRow';
import tagShape from 'Helpers/Props/Shapes/tagShape';
import translate from 'Utilities/String/translate';
import getSelectedIds from 'Utilities/Table/getSelectedIds';
import selectAll from 'Utilities/Table/selectAll';
import toggleSelected from 'Utilities/Table/toggleSelected';
import styles from './PlaylistInput.css';
@ -46,7 +45,17 @@ class PlaylistInput extends Component {
onChange
} = this.props;
const oldSelected = getSelectedIds(prevState.selectedState, { parseIds: false }).sort();
const oldSelected = _.reduce(
prevState.selectedState,
(result, value, id) => {
if (value) {
result.push(id);
}
return result;
},
[]
).sort();
const newSelected = this.getSelectedIds().sort();
if (!_.isEqual(oldSelected, newSelected)) {
@ -61,7 +70,17 @@ class PlaylistInput extends Component {
// Control
getSelectedIds = () => {
return getSelectedIds(this.state.selectedState, { parseIds: false });
return _.reduce(
this.state.selectedState,
(result, value, id) => {
if (value) {
result.push(id);
}
return result;
},
[]
);
};
//