graceguo-supercat commented on a change in pull request #7700: [dashboard] 
trigger query for chart in nested tab only after chart becomes visible
URL: 
https://github.com/apache/incubator-superset/pull/7700#discussion_r293571392
 
 

 ##########
 File path: superset/assets/src/dashboard/components/gridComponents/Tabs.jsx
 ##########
 @@ -204,45 +205,50 @@ class Tabs extends React.PureComponent {
               mountOnEnter
               unmountOnExit={false}
             >
-              {tabIds.map((tabId, tabIndex) => (
-                // react-bootstrap doesn't render a Tab if we move this to its 
own Tab.jsx so we
-                // use `renderType` to indicate what the DashboardComponent 
should render. This
-                // prevents us from passing the entire dashboard component 
lookup to render Tabs.jsx
-                <BootstrapTab
-                  key={tabId}
-                  eventKey={tabIndex}
-                  title={
-                    <DashboardComponent
-                      id={tabId}
-                      parentId={tabsComponent.id}
-                      depth={depth}
-                      index={tabIndex}
-                      renderType={RENDER_TAB}
-                      availableColumnCount={availableColumnCount}
-                      columnWidth={columnWidth}
-                      onDropOnTab={this.handleDropOnTab}
-                      onDeleteTab={this.handleDeleteTab}
-                    />
-                  }
-                >
-                  {renderTabContent && (
-                    <DashboardComponent
-                      id={tabId}
-                      parentId={tabsComponent.id}
-                      depth={depth} // see isValidChild.js for why tabs don't 
increment child depth
-                      index={tabIndex}
-                      renderType={RENDER_TAB_CONTENT}
-                      availableColumnCount={availableColumnCount}
-                      columnWidth={columnWidth}
-                      onResizeStart={onResizeStart}
-                      onResize={onResize}
-                      onResizeStop={onResizeStop}
-                      onDropOnTab={this.handleDropOnTab}
-                      isComponentVisible={selectedTabIndex === tabIndex}
-                    />
-                  )}
-                </BootstrapTab>
-              ))}
+              {tabIds.map((tabId, tabIndex) => {
+                const isTabContentVisible =
+                  selectedTabIndex === tabIndex &&
+                  (renderTabContent ? isComponentVisible : true);
 
 Review comment:
   I updated the logic be more clear.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to