Skip to content

Commit

Permalink
fix(emotions): fix selected emotions array issue 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
brionmario committed May 3, 2019
1 parent ec51041 commit 5382429
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/views/sessions/emotions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ class Emotions extends Component {

const _selectedEmotions = _.cloneDeep(selectedEmotions);

if (_emotion.selected) {
if (!emotion.selected) {
_selectedEmotions.push(_emotion.name);
} else {
const index_selected = _.findIndex(_selectedEmotions, _emotion.name);
_selectedEmotions.splice(index_selected, 1, _emotion.name);
const idx = _.indexOf(_selectedEmotions, _emotion.name);
_selectedEmotions.splice(idx, 1, _emotion.name);
}

this.setState({ selectedEmotions: _selectedEmotions });
Expand Down

0 comments on commit 5382429

Please sign in to comment.