diff --git a/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx b/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx index 15b26c809..575cb7de8 100644 --- a/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx +++ b/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx @@ -23,7 +23,9 @@ function DashboardModal(props) { const onSave = () => { dashboardStore.save(dashboard).then(hideModal).then(() => { - dashboardStore.fetch(dashboard.dashboardId) + if (dashboard.exists()) { + dashboardStore.fetch(dashboard.dashboardId) + } }) } diff --git a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx index 0f073e8e3..55552a78f 100644 --- a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx +++ b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx @@ -13,7 +13,6 @@ import { getStartAndEndTimestampsByDensity } from 'Types/dashboard/helper'; interface Props { metric: any; isWidget?: boolean - onClick?: () => void; } function WidgetChart(props: Props) { const { isWidget = false, metric } = props; diff --git a/frontend/app/components/Dashboard/components/WidgetWrapper/WidgetWrapper.tsx b/frontend/app/components/Dashboard/components/WidgetWrapper/WidgetWrapper.tsx index dbca839e9..75b074281 100644 --- a/frontend/app/components/Dashboard/components/WidgetWrapper/WidgetWrapper.tsx +++ b/frontend/app/components/Dashboard/components/WidgetWrapper/WidgetWrapper.tsx @@ -69,7 +69,7 @@ function WidgetWrapper(props: Props) { const onChartClick = () => { if (!isWidget || isPredefined) return; - props.history.push(withSiteId(dashboardMetricDetails(dashboardId, widget.metricId),siteId)); + props.history.push(withSiteId(dashboardMetricDetails(dashboard?.dashboardId, widget.metricId),siteId)); } const ref: any = useRef(null) diff --git a/frontend/app/mstore/dashboardStore.ts b/frontend/app/mstore/dashboardStore.ts index 503ea285f..65de46ce4 100644 --- a/frontend/app/mstore/dashboardStore.ts +++ b/frontend/app/mstore/dashboardStore.ts @@ -222,6 +222,7 @@ export default class DashboardStore implements IDashboardSotre { if (isCreating) { toast.success('Dashboard created successfully') this.addDashboard(_dashboard) + console.log('_dashboard', _dashboard) } else { toast.success('Dashboard updated successfully') this.updateDashboard(_dashboard) @@ -295,7 +296,7 @@ export default class DashboardStore implements IDashboardSotre { } addDashboard(dashboard: Dashboard) { - this.dashboards.push(dashboard) + this.dashboards.push(new Dashboard().fromJson(dashboard)) } removeDashboard(dashboard: Dashboard) {