Skip to content

Commit e2c2bd3

Browse files
committed
remove callbacks
1 parent ab1537d commit e2c2bd3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/components/library/library.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,29 @@ class LibraryComponent extends React.Component {
7777
selectedTag: tag.toLowerCase()
7878
});
7979
} else {
80-
const playingId = this.state.playingItem;
80+
this.props.onItemMouseLeave(this.getFilteredData()[[this.state.playingItem]]);
8181
this.setState({
8282
filterQuery: '',
8383
playingItem: null,
8484
selectedTag: tag.toLowerCase()
85-
}, this.props.onItemMouseLeave(this.getFilteredData()[[playingId]]));
85+
});
8686
}
8787
}
8888
handleMouseEnter (id) {
8989
// don't restart if mouse over already playing item
9090
if (this.props.onItemMouseEnter && this.state.playingItem !== id) {
91+
this.props.onItemMouseEnter(this.getFilteredData()[id]);
9192
this.setState({
9293
playingItem: id
93-
}, this.props.onItemMouseEnter(this.getFilteredData()[id]));
94+
});
9495
}
9596
}
9697
handleMouseLeave (id) {
9798
if (this.props.onItemMouseLeave) {
99+
this.props.onItemMouseLeave(this.getFilteredData()[id]);
98100
this.setState({
99101
playingItem: null
100-
}, this.props.onItemMouseLeave(this.getFilteredData()[id]));
102+
});
101103
}
102104
}
103105
handlePlayingEnd () {
@@ -114,12 +116,12 @@ class LibraryComponent extends React.Component {
114116
selectedTag: ALL_TAG.tag
115117
});
116118
} else {
117-
const playingId = this.state.playingItem;
119+
this.props.onItemMouseLeave(this.getFilteredData()[[this.state.playingItem]]);
118120
this.setState({
119121
filterQuery: event.target.value,
120122
playingItem: null,
121123
selectedTag: ALL_TAG.tag
122-
}, this.props.onItemMouseLeave(this.getFilteredData()[[playingId]]));
124+
});
123125
}
124126
}
125127
handleFilterClear () {

0 commit comments

Comments
 (0)