mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 02:15:52 +08:00
fix: dashboard data is flushed from redux while creating the dashboard from import dashboard json
This commit is contained in:
parent
dbe68c064c
commit
ba35b3e442
@ -15,7 +15,11 @@ import ROUTES from 'constants/routes';
|
|||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
import { generatePath } from 'react-router-dom';
|
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 { DashboardData } from 'types/api/dashboard/getAll';
|
||||||
|
|
||||||
import { EditorContainer, FooterContainer } from './styles';
|
import { EditorContainer, FooterContainer } from './styles';
|
||||||
@ -30,6 +34,8 @@ function ImportJSON({
|
|||||||
const [isCreateDashboardError, setIsCreateDashboardError] = useState<boolean>(
|
const [isCreateDashboardError, setIsCreateDashboardError] = useState<boolean>(
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
const dispatch = useDispatch<Dispatch<AppActions>>();
|
||||||
|
|
||||||
const [dashboardCreating, setDashboardCreating] = useState<boolean>(false);
|
const [dashboardCreating, setDashboardCreating] = useState<boolean>(false);
|
||||||
|
|
||||||
const [editorValue, setEditorValue] = useState<string>('');
|
const [editorValue, setEditorValue] = useState<string>('');
|
||||||
@ -86,6 +92,9 @@ function ImportJSON({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
|
dispatch({
|
||||||
|
type: FLUSH_DASHBOARD,
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
history.push(
|
history.push(
|
||||||
generatePath(ROUTES.DASHBOARD, {
|
generatePath(ROUTES.DASHBOARD, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user