From 3dc128d22839e757765b62385e869503da1ab001 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Fri, 3 Feb 2023 14:04:17 -0500 Subject: [PATCH] fix: Form data was not being passed to save/update slice (#22989) (cherry picked from commit c9b9b7404a2440a4c9d3173f0c494ed40f7fa2bd) --- .../src/explore/components/SaveModal.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx index 0fe45d339693c..8552eff7fad3b 100644 --- a/superset-frontend/src/explore/components/SaveModal.tsx +++ b/superset-frontend/src/explore/components/SaveModal.tsx @@ -198,6 +198,8 @@ class SaveModal extends React.Component { ); } + const { url_params, ...formData } = this.props.form_data || {}; + let dashboard: DashboardGetResponse | null = null; if (this.state.newDashboardName || this.state.saveToDashboardId) { let saveToDashboardId = this.state.saveToDashboardId || null; @@ -216,14 +218,13 @@ class SaveModal extends React.Component { sliceDashboards = sliceDashboards.includes(dashboard.id) ? sliceDashboards : [...sliceDashboards, dashboard.id]; - const { url_params, ...formData } = this.props.form_data || {}; - this.props.actions.setFormData({ - ...formData, - dashboards: sliceDashboards, - }); + formData.dashboards = sliceDashboards; } } + // Sets the form data + this.props.actions.setFormData({ ...formData }); + // Update or create slice let value: { id: number }; if (this.state.action === 'overwrite') {