From 0a13a0ea59bb8324f535819e284dc48afa893cae Mon Sep 17 00:00:00 2001 From: Psami-wondah Date: Mon, 9 Dec 2024 11:17:51 +0100 Subject: [PATCH 1/2] feat: Deleted asset(data) not removing from cache immediately --- src/app/components/Dialogs/deleteChartDialog.tsx | 5 ++++- src/app/components/Dialogs/deleteDatasetDialog.tsx | 6 +++++- src/app/components/Dialogs/deleteReportDialog.tsx | 5 ++++- .../components/chartSubheaderToolbar/index.tsx | 7 ++++--- .../dataset-module/component/datasetSubHeaderToolbar.tsx | 6 ++++-- .../components/reportSubHeaderToolbar/index.tsx | 7 ++++--- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/app/components/Dialogs/deleteChartDialog.tsx b/src/app/components/Dialogs/deleteChartDialog.tsx index ac9b555f9..ee50fb62b 100644 --- a/src/app/components/Dialogs/deleteChartDialog.tsx +++ b/src/app/components/Dialogs/deleteChartDialog.tsx @@ -54,7 +54,10 @@ export default function DeleteChartDialog(props: Props) { >
props.handleDelete(props.cardId as string)} + onSubmit={(e) => { + e.preventDefault(); + props.handleDelete(props.cardId as string); + }} data-cy="delete-chart-item-form" aria-label="form" > diff --git a/src/app/components/Dialogs/deleteDatasetDialog.tsx b/src/app/components/Dialogs/deleteDatasetDialog.tsx index da8c0acfc..16045edef 100644 --- a/src/app/components/Dialogs/deleteDatasetDialog.tsx +++ b/src/app/components/Dialogs/deleteDatasetDialog.tsx @@ -72,8 +72,12 @@ export default function DeleteDatasetDialog(props: Props) { ) : (
props.handleDelete(props.cardId)} + onSubmit={(e) => { + e.preventDefault(); + props.handleDelete(props.cardId); + }} data-cy="delete-dataset-item-form" + aria-label="form" >
props.handleDelete(props.cardId as string)} + onSubmit={(e) => { + e.preventDefault(); + props.handleDelete(props.cardId as string); + }} data-cy="delete-report-item-form" aria-label="form" > diff --git a/src/app/modules/chart-module/components/chartSubheaderToolbar/index.tsx b/src/app/modules/chart-module/components/chartSubheaderToolbar/index.tsx index fe94f9da9..142025722 100644 --- a/src/app/modules/chart-module/components/chartSubheaderToolbar/index.tsx +++ b/src/app/modules/chart-module/components/chartSubheaderToolbar/index.tsx @@ -229,9 +229,10 @@ export function ChartSubheaderToolbar( filterString: "filter[order]=updatedDate desc", }); }) - .catch((error) => console.log(error)); - - history.replace("/"); + .catch((error) => console.log(error)) + .finally(() => { + history.replace("/"); + }); }; const handleDuplicate = () => { diff --git a/src/app/modules/dataset-module/component/datasetSubHeaderToolbar.tsx b/src/app/modules/dataset-module/component/datasetSubHeaderToolbar.tsx index 9d406388c..04cbea3c3 100644 --- a/src/app/modules/dataset-module/component/datasetSubHeaderToolbar.tsx +++ b/src/app/modules/dataset-module/component/datasetSubHeaderToolbar.tsx @@ -157,8 +157,10 @@ export default function DatasetSubHeaderToolbar( filterString: "filter[order]=updatedDate desc", }); }) - .catch((error) => console.log(error)); - history.replace("/"); + .catch((error) => console.log(error)) + .finally(() => { + history.replace("/"); + }); } return ( diff --git a/src/app/modules/report-module/components/reportSubHeaderToolbar/index.tsx b/src/app/modules/report-module/components/reportSubHeaderToolbar/index.tsx index 3d62240ee..1c0cdafc3 100644 --- a/src/app/modules/report-module/components/reportSubHeaderToolbar/index.tsx +++ b/src/app/modules/report-module/components/reportSubHeaderToolbar/index.tsx @@ -205,9 +205,10 @@ export function ReportSubheaderToolbar( filterString: "filter[order]=updatedDate desc", }); }) - .catch((error) => console.log(error)); - - history.replace("/"); + .catch((error) => console.log(error)) + .finally(() => { + history.replace("/"); + }); }; const handleDuplicate = () => { From a9b800ee4a6f9bea56547070ae5728df903beb24 Mon Sep 17 00:00:00 2001 From: Psami-wondah Date: Mon, 9 Dec 2024 11:41:10 +0100 Subject: [PATCH 2/2] feat: DX-2121 - Chart creating twice --- src/app/modules/chart-module/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/modules/chart-module/index.tsx b/src/app/modules/chart-module/index.tsx index 8a2d8f15b..87c6d1c2e 100644 --- a/src/app/modules/chart-module/index.tsx +++ b/src/app/modules/chart-module/index.tsx @@ -282,13 +282,7 @@ export default function ChartModule() { isMappingValid, isAIAssisted: selectedAIChart, }; - if (view !== undefined && page !== "new") { - editChart({ - token, - patchId: page, - values: chart, - }); - } else { + if (page === "new") { try { return await axios.post(`${process.env.REACT_APP_API}/chart/`, chart, { headers: { @@ -299,6 +293,12 @@ export default function ChartModule() { } catch (e) { console.log(e); } + } else if (view !== undefined) { + editChart({ + token, + patchId: page, + values: chart, + }); } };