From ba35b3e4425b2ba7d5fe0a8114b04ec3964ad434 Mon Sep 17 00:00:00 2001 From: Palash Date: Wed, 29 Jun 2022 12:35:45 +0530 Subject: [PATCH] fix: dashboard data is flushed from redux while creating the dashboard from import dashboard json --- .../src/container/ListOfDashboard/ImportJSON/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx b/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx index 021a5f9805..e1107fd9f2 100644 --- a/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx +++ b/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx @@ -15,7 +15,11 @@ import ROUTES from 'constants/routes'; import history from 'lib/history'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useDispatch } from 'react-redux'; import { generatePath } from 'react-router-dom'; +import { Dispatch } from 'redux'; +import AppActions from 'types/actions'; +import { FLUSH_DASHBOARD } from 'types/actions/dashboard'; import { DashboardData } from 'types/api/dashboard/getAll'; import { EditorContainer, FooterContainer } from './styles'; @@ -30,6 +34,8 @@ function ImportJSON({ const [isCreateDashboardError, setIsCreateDashboardError] = useState( false, ); + const dispatch = useDispatch>(); + const [dashboardCreating, setDashboardCreating] = useState(false); const [editorValue, setEditorValue] = useState(''); @@ -86,6 +92,9 @@ function ImportJSON({ }); if (response.statusCode === 200) { + dispatch({ + type: FLUSH_DASHBOARD, + }); setTimeout(() => { history.push( generatePath(ROUTES.DASHBOARD, {