Skip to content

Commit

Permalink
Fix resetting radio button state after closing the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Oct 27, 2022
1 parent 4508e14 commit fb7321c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const propTypes = {
impressionId: PropTypes.string,
vizType: PropTypes.string,
saveAction: PropTypes.string,
isSaveModalVisible: PropTypes.bool,
};

const ExploreContainer = styled.div`
Expand Down Expand Up @@ -686,22 +687,32 @@ function ExploreViewContainer(props) {
{renderChartContainer()}
</div>
</ExplorePanelContainer>
<SaveModal
addDangerToast={props.addDangerToast}
actions={props.actions}
form_data={props.form_data}
sliceName={props.sliceName}
dashboardId={props.dashboardId}
/>
{props.isSaveModalVisible && (
<SaveModal
addDangerToast={props.addDangerToast}
actions={props.actions}
form_data={props.form_data}
sliceName={props.sliceName}
dashboardId={props.dashboardId}
/>
)}
</ExploreContainer>
);
}

ExploreViewContainer.propTypes = propTypes;

function mapStateToProps(state) {
const { explore, charts, common, impressionId, dataMask, reports, user } =
state;
const {
explore,
charts,
common,
impressionId,
dataMask,
reports,
user,
saveModal,
} = state;
const { controls, slice, datasource, metadata } = explore;
const form_data = getFormDataFromControls(controls);
const slice_id = form_data.slice_id ?? slice?.slice_id ?? 0; // 0 - unsaved chart
Expand Down Expand Up @@ -750,6 +761,7 @@ function mapStateToProps(state) {
reports,
metadata,
saveAction: explore.saveAction,
isSaveModalVisible: saveModal.isVisible,
};
}

Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/explore/components/SaveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import ReactMarkdown from 'react-markdown';
import { withRouter, RouteComponentProps } from 'react-router-dom';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import {
css,
t,
styled,
DatasourceType,
Expand Down

0 comments on commit fb7321c

Please sign in to comment.