From d38a29d92ec0eafc1a9da3b0f5a6b26f5c18422c Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Tue, 26 Nov 2024 09:40:44 -0800 Subject: [PATCH] Fix flaky load of spans table Signed-off-by: Shenoy Pratik --- .../components/services/service_view.tsx | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/public/components/trace_analytics/components/services/service_view.tsx b/public/components/trace_analytics/components/services/service_view.tsx index 8a87afb81..fede7e680 100644 --- a/public/components/trace_analytics/components/services/service_view.tsx +++ b/public/components/trace_analytics/components/services/service_view.tsx @@ -488,20 +488,22 @@ export function ServiceView(props: ServiceViewProps) { }, [spanFilters]); const [total, setTotal] = useState(0); - const spanDetailTable = useMemo( - () => ( - setCurrentSpan(spanId)} - setTotal={setTotal} - mode={mode} - dataSourceMDSId={props.dataSourceMDSId[0].id} - /> - ), - [DSL, setCurrentSpan, spanFilters] - ); + const spanDetailTable = useMemo(() => { + // only render when time and service state updates in DSL + if (Object.keys(DSL).length > 0) + return ( + setCurrentSpan(spanId)} + setTotal={setTotal} + mode={mode} + dataSourceMDSId={props.dataSourceMDSId[0].id} + /> + ); + return <>; + }, [DSL, setCurrentSpan, spanFilters]); const pageToRender = ( <>