diff --git a/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx b/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx index 955ade713..ff4421977 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx +++ b/superset-frontend/spec/javascripts/dashboard/components/gridComponents/Chart_spec.jsx @@ -20,7 +20,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import sinon from 'sinon'; -import Chart from 'src/dashboard/components/gridComponents/Chart'; +import { ChartUnconnected as Chart } from 'src/dashboard/components/gridComponents/Chart'; import SliceHeader from 'src/dashboard/components/SliceHeader'; import ChartContainer from 'src/chart/ChartContainer'; @@ -44,6 +44,7 @@ describe('Chart', () => { slice: { ...sliceEntities.slices[queryId], description_markeddown: 'markdown', + owners: [], }, sliceName: sliceEntities.slices[queryId].slice_name, timeout: 60, @@ -52,6 +53,13 @@ describe('Chart', () => { toggleExpandSlice() {}, addFilter() {}, logEvent() {}, + handleToggleFullSize() {}, + changeFilter() {}, + setFocusedFilterField() {}, + unsetFocusedFilterField() {}, + addDangerToast() {}, + componentId: 'test', + dashboardId: 111, editMode: false, isExpanded: false, supersetCanExplore: false, diff --git a/superset-frontend/src/chart/Chart.jsx b/superset-frontend/src/chart/Chart.jsx index ff5a57076..6e4374da1 100644 --- a/superset-frontend/src/chart/Chart.jsx +++ b/superset-frontend/src/chart/Chart.jsx @@ -63,6 +63,8 @@ const propTypes = { onQuery: PropTypes.func, onFilterMenuOpen: PropTypes.func, onFilterMenuClose: PropTypes.func, + // id of the last mounted parent tab + mountedParent: PropTypes.string, }; const BLANK = {}; diff --git a/superset-frontend/src/chart/ChartRenderer.jsx b/superset-frontend/src/chart/ChartRenderer.jsx index 7d51761b5..58ea5c5fd 100644 --- a/superset-frontend/src/chart/ChartRenderer.jsx +++ b/superset-frontend/src/chart/ChartRenderer.jsx @@ -86,8 +86,7 @@ class ChartRenderer extends React.Component { if (resultsReady) { this.hasQueryResponseChange = nextProps.queryResponse !== this.props.queryResponse; - - if ( + return ( this.hasQueryResponseChange || nextProps.annotationData !== this.props.annotationData || nextProps.height !== this.props.height || @@ -95,9 +94,7 @@ class ChartRenderer extends React.Component { nextProps.triggerRender || nextProps.formData.color_scheme !== this.props.formData.color_scheme || nextProps.cacheBusterProp !== this.props.cacheBusterProp - ) { - return true; - } + ); } return false; } diff --git a/superset-frontend/src/dashboard/actions/dashboardState.js b/superset-frontend/src/dashboard/actions/dashboardState.js index 024c88461..bd07cef4a 100644 --- a/superset-frontend/src/dashboard/actions/dashboardState.js +++ b/superset-frontend/src/dashboard/actions/dashboardState.js @@ -321,6 +321,14 @@ export function setDirectPathToChild(path) { return { type: SET_DIRECT_PATH, path }; } +export const SET_MOUNTED_TAB = 'SET_MOUNTED_TAB'; +/** + * Set if tab switch animation is in progress + */ +export function setMountedTab(mountedTab) { + return { type: SET_MOUNTED_TAB, mountedTab }; +} + export const SET_FOCUSED_FILTER_FIELD = 'SET_FOCUSED_FILTER_FIELD'; export function setFocusedFilterField(chartId, column) { return { type: SET_FOCUSED_FILTER_FIELD, chartId, column }; diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder.jsx b/superset-frontend/src/dashboard/components/DashboardBuilder.jsx index 5ca6f2db1..ecaf3cf2e 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder.jsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder.jsx @@ -60,6 +60,7 @@ const propTypes = { handleComponentDrop: PropTypes.func.isRequired, directPathToChild: PropTypes.arrayOf(PropTypes.string), setDirectPathToChild: PropTypes.func.isRequired, + setMountedTab: PropTypes.func.isRequired, }; const defaultProps = { @@ -247,6 +248,12 @@ class DashboardBuilder extends React.Component { { + // Entering current tab, DOM is visible and has dimension + this.props.setMountedTab(id); + }} > } + onEntering={() => { + // Entering current tab, DOM is visible and has dimension + if (renderTabContent) { + this.props.setMountedTab(tabId); + } + }} > {renderTabContent && (