Skip to content

Commit 6ee05f2

Browse files
authored
feat(dashboards): persist changes on modal close (#68882)
1 parent d54959f commit 6ee05f2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

static/app/components/modals/metricWidgetViewerModal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function MetricWidgetViewerModal({
4646
Body,
4747
Header,
4848
closeModal,
49+
CloseButton,
4950
onMetricWidgetEdit,
5051
dashboardFilters,
5152
}: Props) {
@@ -227,13 +228,17 @@ function MetricWidgetViewerModal({
227228
return (
228229
<Fragment>
229230
<OrganizationContext.Provider value={organization}>
230-
<Header closeButton>
231+
<Header>
231232
<MetricWidgetTitle
232233
title={title}
233234
onTitleChange={handleTitleChange}
234235
placeholder={widgetMQL}
235236
description={widget.description}
236237
/>
238+
{/* Added a div with onClick because CloseButton overrides passed onClick handler */}
239+
<div onClick={handleSubmit}>
240+
<CloseButton />
241+
</div>
237242
</Header>
238243
<Body>
239244
<Queries
@@ -269,7 +274,6 @@ function MetricWidgetViewerModal({
269274
>
270275
{t('Open in Metrics')}
271276
</LinkButton>
272-
<Button onClick={closeModal}>{t('Close')}</Button>
273277
<Button priority="primary" onClick={handleSubmit}>
274278
{t('Save changes')}
275279
</Button>

0 commit comments

Comments
 (0)