diff --git a/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx b/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx
index 5ac13ef9f..3579baae3 100644
--- a/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx
+++ b/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import { useStore } from 'App/mstore';
-import { Loader, Tooltip, Popover } from 'UI';
+import { Loader } from 'UI';
import { withSiteId } from 'App/routes';
import withModal from 'App/components/Modal/withModal';
import DashboardWidgetGrid from '../DashboardWidgetGrid';
diff --git a/frontend/app/components/Dashboard/components/MetricsLibraryModal/MetricsLibraryModal.tsx b/frontend/app/components/Dashboard/components/MetricsLibraryModal/MetricsLibraryModal.tsx
index 155c3c123..5755211c1 100644
--- a/frontend/app/components/Dashboard/components/MetricsLibraryModal/MetricsLibraryModal.tsx
+++ b/frontend/app/components/Dashboard/components/MetricsLibraryModal/MetricsLibraryModal.tsx
@@ -16,8 +16,8 @@ function MetricsLibraryModal(props: Props) {
const [selectedList, setSelectedList] = useState([]);
useEffect(() => {
- metricStore.updateKey('listView', true)
- }, [])
+ metricStore.updateKey('listView', true);
+ }, []);
const onSelectionChange = (list: any) => {
setSelectedList(list);
@@ -26,7 +26,7 @@ function MetricsLibraryModal(props: Props) {
return (
<>
-
+
@@ -47,7 +47,11 @@ function SelectedContent({ dashboardId, selected }: any) {
const dashboard = useMemo(() => dashboardStore.getDashboard(dashboardId), [dashboardId]);
const addSelectedToDashboard = () => {
- dashboardStore.addWidgetToDashboard(dashboard, selected).then(hideModal);
+ if (!dashboard || !dashboard.dashboardId) return;
+ dashboardStore.addWidgetToDashboard(dashboard, selected).then(() => {
+ hideModal();
+ dashboardStore.fetch(dashboard.dashboardId);
+ });
};
return (