From e2c2bd3927dd40c88e6793bef14880c04dcf78d2 Mon Sep 17 00:00:00 2001
From: Chris Garrity <chrisg@media.mit.edu>
Date: Wed, 31 Jul 2019 15:37:50 -0400
Subject: [PATCH] remove callbacks

---
 src/components/library/library.jsx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/components/library/library.jsx b/src/components/library/library.jsx
index f85def50f..1272cb4a1 100644
--- a/src/components/library/library.jsx
+++ b/src/components/library/library.jsx
@@ -77,27 +77,29 @@ class LibraryComponent extends React.Component {
                 selectedTag: tag.toLowerCase()
             });
         } else {
-            const playingId = this.state.playingItem;
+            this.props.onItemMouseLeave(this.getFilteredData()[[this.state.playingItem]]);
             this.setState({
                 filterQuery: '',
                 playingItem: null,
                 selectedTag: tag.toLowerCase()
-            }, this.props.onItemMouseLeave(this.getFilteredData()[[playingId]]));
+            });
         }
     }
     handleMouseEnter (id) {
         // don't restart if mouse over already playing item
         if (this.props.onItemMouseEnter && this.state.playingItem !== id) {
+            this.props.onItemMouseEnter(this.getFilteredData()[id]);
             this.setState({
                 playingItem: id
-            }, this.props.onItemMouseEnter(this.getFilteredData()[id]));
+            });
         }
     }
     handleMouseLeave (id) {
         if (this.props.onItemMouseLeave) {
+            this.props.onItemMouseLeave(this.getFilteredData()[id]);
             this.setState({
                 playingItem: null
-            }, this.props.onItemMouseLeave(this.getFilteredData()[id]));
+            });
         }
     }
     handlePlayingEnd () {
@@ -114,12 +116,12 @@ class LibraryComponent extends React.Component {
                 selectedTag: ALL_TAG.tag
             });
         } else {
-            const playingId = this.state.playingItem;
+            this.props.onItemMouseLeave(this.getFilteredData()[[this.state.playingItem]]);
             this.setState({
                 filterQuery: event.target.value,
                 playingItem: null,
                 selectedTag: ALL_TAG.tag
-            }, this.props.onItemMouseLeave(this.getFilteredData()[[playingId]]));
+            });
         }
     }
     handleFilterClear () {
-- 
GitLab