etr2460 commented on a change in pull request #9733:
URL: 
https://github.com/apache/incubator-superset/pull/9733#discussion_r420220295



##########
File path: superset-frontend/src/dashboard/components/Dashboard.jsx
##########
@@ -158,6 +173,27 @@ class Dashboard extends React.PureComponent {
     }
   }
 
+  componentWillUnmount() {
+    window.removeEventListener('visibilitychange', this.onVisibilityChange);
+  }
+
+  onVisibilityChange() {
+    if (document.visibilityState === 'hidden') {
+      // from visible to hidden
+      this.visibilityEventData = {
+        start_offset: Logger.getTimestamp(),
+        ts: new Date().getTime(),
+      };
+    } else if (document.visibilityState === 'visible') {
+      // from hidden to visible
+      const logStart = this.visibilityEventData.start_offset;

Review comment:
       do we need this extra variable if it's only being used once?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to