mirror of
https://github.com/apache/superset.git
synced 2026-04-26 19:44:58 +00:00
fix(explore): only refresh data panel on relevant changes (#16699)
* fix(explore): only refresh data panel on relevant changes * add comment and supress warning
This commit is contained in:
@@ -221,7 +221,7 @@ export const DataTablesPane = ({
|
|||||||
...prevState,
|
...prevState,
|
||||||
[RESULT_TYPES.samples]: true,
|
[RESULT_TYPES.samples]: true,
|
||||||
}));
|
}));
|
||||||
}, [queryFormData.adhoc_filters, queryFormData.datasource]);
|
}, [queryFormData?.adhoc_filters, queryFormData?.datasource]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (queriesResponse && chartStatus === 'success') {
|
if (queriesResponse && chartStatus === 'success') {
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ const ExploreChartPanel = props => {
|
|||||||
},
|
},
|
||||||
[slice],
|
[slice],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateQueryContext();
|
updateQueryContext();
|
||||||
}, [updateQueryContext]);
|
}, [updateQueryContext]);
|
||||||
@@ -257,6 +258,22 @@ const ExploreChartPanel = props => {
|
|||||||
[chartPanelRef, renderChart],
|
[chartPanelRef, renderChart],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [queryFormData, setQueryFormData] = useState(
|
||||||
|
props.chart.latestQueryFormData,
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// only update when `latestQueryFormData` changes AND `triggerRender`
|
||||||
|
// is false. No update should be done when only `triggerRender` changes,
|
||||||
|
// as this can trigger a query downstream based on incomplete form data.
|
||||||
|
// (`latestQueryFormData` is only updated when a a valid request has been
|
||||||
|
// triggered).
|
||||||
|
if (!props.triggerRender) {
|
||||||
|
setQueryFormData(props.chart.latestQueryFormData);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [props.chart.latestQueryFormData]);
|
||||||
|
|
||||||
if (props.standalone) {
|
if (props.standalone) {
|
||||||
// dom manipulation hack to get rid of the boostrap theme's body background
|
// dom manipulation hack to get rid of the boostrap theme's body background
|
||||||
const standaloneClass = 'background-transparent';
|
const standaloneClass = 'background-transparent';
|
||||||
@@ -309,7 +326,7 @@ const ExploreChartPanel = props => {
|
|||||||
{panelBody}
|
{panelBody}
|
||||||
<DataTablesPane
|
<DataTablesPane
|
||||||
ownState={props.ownState}
|
ownState={props.ownState}
|
||||||
queryFormData={props.chart.latestQueryFormData}
|
queryFormData={queryFormData}
|
||||||
tableSectionHeight={tableSectionHeight}
|
tableSectionHeight={tableSectionHeight}
|
||||||
onCollapseChange={onCollapseChange}
|
onCollapseChange={onCollapseChange}
|
||||||
chartStatus={props.chart.chartStatus}
|
chartStatus={props.chart.chartStatus}
|
||||||
|
|||||||
Reference in New Issue
Block a user