geido commented on code in PR #20448:
URL: https://github.com/apache/superset/pull/20448#discussion_r905966500
##########
superset-frontend/src/explore/components/ExploreViewContainer/index.jsx:
##########
@@ -693,53 +694,62 @@ function ExploreViewContainer(props) {
ExploreViewContainer.propTypes = propTypes;
function mapStateToProps(state) {
- const { explore, charts, impressionId, dataMask, reports } = state;
- const form_data = getFormDataFromControls(explore.controls);
+ const {
+ explore,
+ charts,
+ common,
+ impressionId,
+ dataMask,
+ reports,
+ datasources,
+ user,
+ } = state;
+ const { controls, slice } = explore;
+ const form_data = getFormDataFromControls(controls);
+ const slice_id = form_data.slice_id ?? slice?.slice_id ?? 0; // 0 - unsaved
chart
form_data.extra_form_data = mergeExtraFormData(
{ ...form_data.extra_form_data },
{
- ...dataMask[form_data.slice_id ?? 0]?.ownState, // 0 - unsaved chart
+ ...dataMask[slice_id]?.ownState,
},
);
- const chartKey = Object.keys(charts)[0];
- const chart = charts[chartKey];
+ const chart = charts[slice_id];
let dashboardId = Number(explore.form_data?.dashboardId);
if (Number.isNaN(dashboardId)) {
dashboardId = undefined;
}
+ const datasource = datasources[form_data.datasource];
+
return {
isDatasourceMetaLoading: explore.isDatasourceMetaLoading,
- datasource: explore.datasource,
- datasource_type: explore.datasource.type,
- datasourceId: explore.datasource_id,
+ datasource,
+ datasource_type: datasource.type,
Review Comment:
I think this might be a good time to make also the property names
consistent, some of them are camel case, some others use hyphens currently
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]