Commit 0d086448 authored by NataliaTepluhina's avatar NataliaTepluhina

Replaced includes with some

parent fa24a09c
......@@ -34,12 +34,11 @@ export default {
// Iterate over every label and add a `set` prop
// to determine whether it is already a part of
// selectedLabels array.
const selectedLabelIds = state.selectedLabels.map((label) => label.id);
state.labelsFetchInProgress = false;
state.labelsFetched = true;
state.labels = labels.map((label) => ({
...label,
set: selectedLabelIds.includes(label.id),
set: state.selectedLabels.some((selectedLabel) => selectedLabel.id === label.id),
}));
},
[types.RECEIVE_SET_LABELS_FAILURE](state) {
......@@ -79,10 +78,9 @@ export default {
},
[types.UPDATE_LABELS_SET_STATE](state) {
const selectedLabelIds = state.selectedLabels.map((label) => label.id);
state.labels = state.labels.map((label) => ({
...label,
set: selectedLabelIds.includes(label.id),
set: state.selectedLabels.some((selectedLabel) => selectedLabel.id === label.id),
}));
},
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment