mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 19:25:52 +08:00
fix(ServiceMap): multiple api calls of date picker
This commit is contained in:
parent
55f7f56acf
commit
245050aac2
@ -34,7 +34,13 @@ const App = () => {
|
|||||||
<Route path={ROUTES.SIGN_UP} exact component={Signup} />
|
<Route path={ROUTES.SIGN_UP} exact component={Signup} />
|
||||||
<Route path={ROUTES.APPLICATION} exact component={ServicesTable} />
|
<Route path={ROUTES.APPLICATION} exact component={ServicesTable} />
|
||||||
<Route path={ROUTES.SERVICE_METRICS} exact component={ServiceMetrics} />
|
<Route path={ROUTES.SERVICE_METRICS} exact component={ServiceMetrics} />
|
||||||
<Route path={ROUTES.SERVICE_MAP} exact component={ServiceMap} />
|
<Route
|
||||||
|
path={ROUTES.SERVICE_MAP}
|
||||||
|
exact
|
||||||
|
render={(props) => (
|
||||||
|
<ServiceMap {...props} componentPath={ROUTES.SERVICE_MAP} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<Route path={ROUTES.TRACES} exact component={TraceDetail} />
|
<Route path={ROUTES.TRACES} exact component={TraceDetail} />
|
||||||
<Route path={ROUTES.TRACE_GRAPH} exact component={TraceGraph} />
|
<Route path={ROUTES.TRACE_GRAPH} exact component={TraceGraph} />
|
||||||
<Route path={ROUTES.SETTINGS} exact component={SettingsPage} />
|
<Route path={ROUTES.SETTINGS} exact component={SettingsPage} />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { RouteComponentProps } from "react-router-dom";
|
import { RouteComponentProps, useLocation } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
GlobalTime,
|
GlobalTime,
|
||||||
serviceMapStore,
|
serviceMapStore,
|
||||||
@ -36,6 +36,7 @@ interface ServiceMapProps extends RouteComponentProps<any> {
|
|||||||
globalTime: GlobalTime;
|
globalTime: GlobalTime;
|
||||||
getServiceMapItems: Function;
|
getServiceMapItems: Function;
|
||||||
getDetailedServiceMapItems: Function;
|
getDetailedServiceMapItems: Function;
|
||||||
|
componentPath: string;
|
||||||
}
|
}
|
||||||
interface graphNode {
|
interface graphNode {
|
||||||
id: string;
|
id: string;
|
||||||
@ -53,16 +54,19 @@ export interface graphDataType {
|
|||||||
|
|
||||||
const ServiceMap = (props: ServiceMapProps) => {
|
const ServiceMap = (props: ServiceMapProps) => {
|
||||||
const fgRef = useRef();
|
const fgRef = useRef();
|
||||||
|
const location = useLocation();
|
||||||
const {
|
const {
|
||||||
getDetailedServiceMapItems,
|
getDetailedServiceMapItems,
|
||||||
getServiceMapItems,
|
getServiceMapItems,
|
||||||
globalTime,
|
globalTime,
|
||||||
serviceMap,
|
serviceMap,
|
||||||
|
componentPath,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (location.pathname === componentPath) {
|
||||||
getServiceMapItems(globalTime);
|
getServiceMapItems(globalTime);
|
||||||
getDetailedServiceMapItems(globalTime);
|
getDetailedServiceMapItems(globalTime);
|
||||||
|
}
|
||||||
}, [globalTime]);
|
}, [globalTime]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user