You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/07/30 07:29:13 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #10475: fix(dashboard): add animation state to fix tab switch re-renders

ktmud commented on a change in pull request #10475:
URL: https://github.com/apache/incubator-superset/pull/10475#discussion_r462547648



##########
File path: superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx
##########
@@ -260,6 +263,14 @@ class Tabs extends React.PureComponent {
                       onDeleteTab={this.handleDeleteTab}
                     />
                   }
+                  onExiting={() => {
+                    // Exiting previous tab, animating start
+                    this.props.setIsAnimating(true, tabId);
+                  }}
+                  onEntering={() => {
+                    // Entering current tab, DOM is visible and has dimension
+                    this.props.setIsAnimating(false, tabId);
+                  }}

Review comment:
       Use `onEntering` instead of `onEntered` because the contents for the new tab are already mounted to DOM upon entering and have values for dimension properties.

##########
File path: superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx
##########
@@ -260,6 +263,14 @@ class Tabs extends React.PureComponent {
                       onDeleteTab={this.handleDeleteTab}
                     />
                   }
+                  onExiting={() => {
+                    // Exiting previous tab, animating start
+                    this.props.setIsAnimating(true, tabId);
+                  }}
+                  onEntering={() => {
+                    // Entering current tab, DOM is visible and has dimension
+                    this.props.setIsAnimating(false, tabId);
+                  }}

Review comment:
       This may be potentially a source of confusion because the animation didn't completely stop when `isAnimating = true`, but I'm struggling to find more appropriate + succinct variable names.

##########
File path: superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx
##########
@@ -260,6 +263,14 @@ class Tabs extends React.PureComponent {
                       onDeleteTab={this.handleDeleteTab}
                     />
                   }
+                  onExiting={() => {
+                    // Exiting previous tab, animating start
+                    this.props.setIsAnimating(true, tabId);
+                  }}
+                  onEntering={() => {
+                    // Entering current tab, DOM is visible and has dimension
+                    this.props.setIsAnimating(false, tabId);
+                  }}

Review comment:
       Renamed to `isParentMounted` for charts and `isTabMounted` for dashboards.

##########
File path: superset-frontend/src/dashboard/actions/dashboardState.js
##########
@@ -321,6 +321,14 @@ export function setDirectPathToChild(path) {
   return { type: SET_DIRECT_PATH, path };
 }
 
+export const SET_IS_TAB_MOUNTED = 'SET_IS_TAB_MOUNTED';
+/**
+ * Set if tab switch animation is in progress
+ */
+export function setIsTabMounted(isAnimating) {

Review comment:
       Oops, missed it while search and replace. Thanks for catching this!




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org