Skip to content

Commit

Permalink
feat:DX-848; show updated chart in report on first load
Browse files Browse the repository at this point in the history
  • Loading branch information
okorie2 committed Nov 14, 2023
1 parent 997a47b commit 98f35dd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/modules/common/subheader-toolbar/SubheaderToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ export function SubheaderToolbar(props: SubheaderToolbarProps) {
};

React.useEffect(() => {
//completes chart creation, returns back to persisted report view
if (
(editChartSuccess || createChartSuccess) &&
createChartFromReport.state
) {
//returns back to persisted report view
setCreateChartFromReport({
...createChartFromReport,
state: false,
Expand All @@ -206,11 +206,16 @@ export function SubheaderToolbar(props: SubheaderToolbarProps) {
`/report/${createChartFromReport.page}/${createChartFromReport.view}`
);
}
} else if (editChartSuccess && !createChartFromReport.state) {
history.push(`/chart/${page}`);
}
}, [editChartSuccess, createChartSuccess]);

React.useEffect(() => {
if (editChartSuccess && createChartFromReport.view === "") {
console.log(createChartFromReport.state, "state");
history.push(`/chart/${page}`);
}
}, [editChartSuccess]);

React.useEffect(() => {
return () => {
createChartClear();
Expand Down

0 comments on commit 98f35dd

Please sign in to comment.