From dad8c20af78f237cd068e29e1bbe6bbf37a238eb Mon Sep 17 00:00:00 2001 From: Geido <60598000+geido@users.noreply.github.com> Date: Fri, 10 Dec 2021 01:25:01 +0200 Subject: [PATCH] fix(Dashboard): Copy dashboard with duplicating charts 500 error (#17707) * Fix copy dashboard with charts * Fix Cypress test --- .../cypress/integration/dashboard/save.test.js | 8 +++++--- superset-frontend/src/dashboard/actions/dashboardState.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js b/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js index 14e0ce314..8064f81fa 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js @@ -74,7 +74,9 @@ describe('Dashboard save action', () => { .trigger('mouseenter') .click(); - cy.get('[data-test="grid-container"]').find('.treemap').should('not.exist'); + cy.get('[data-test="grid-container"]') + .find('.box_plot') + .should('not.exist'); cy.intercept('PUT', '/api/v1/dashboard/**').as('putDashboardRequest'); cy.get('[data-test="dashboard-header"]') @@ -88,9 +90,9 @@ describe('Dashboard save action', () => { .find('[aria-label="edit-alt"]') .click(); - // deleted treemap should still not exist + // deleted boxplot should still not exist cy.get('[data-test="grid-container"]') - .find('.treemap', { timeout: 20000 }) + .find('.box_plot', { timeout: 20000 }) .should('not.exist'); }); diff --git a/superset-frontend/src/dashboard/actions/dashboardState.js b/superset-frontend/src/dashboard/actions/dashboardState.js index 07799c2e9..60491025d 100644 --- a/superset-frontend/src/dashboard/actions/dashboardState.js +++ b/superset-frontend/src/dashboard/actions/dashboardState.js @@ -347,7 +347,7 @@ export function saveDashboardRequest(data, id, saveType) { .catch(response => onError(response)); } // changing the data as the endpoint requires - const copyData = cleanedData; + const copyData = { ...cleanedData }; if (copyData.metadata) { delete copyData.metadata; }