From 3c7c3883190ec9124a3b88b4418532a9be73fce5 Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Thu, 1 Aug 2024 14:12:04 -0700 Subject: [PATCH] fix direct url load for trace analytics Signed-off-by: Shenoy Pratik --- public/components/trace_analytics/home.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/components/trace_analytics/home.tsx b/public/components/trace_analytics/home.tsx index 5bb98bbea2..8779fba660 100644 --- a/public/components/trace_analytics/home.tsx +++ b/public/components/trace_analytics/home.tsx @@ -120,7 +120,15 @@ export const Home = (props: HomeProps) => { const [dataSourceMDSId, setDataSourceMDSId] = useState([{ id: '', label: '' }]); const [currentSelectedService, setCurrentSelectedService] = useState(''); - const { defaultRoute = '/services' } = props; + let defaultRoute = ''; + const currentHash = window.location.hash.split('#')[1]; + + if (currentHash === '/traces' || currentHash === '/services') { + defaultRoute = currentHash; + } else { + defaultRoute = props.defaultRoute ?? '/services'; + } + const { chrome } = props; const isNavGroupEnabled = chrome.navGroup.getNavGroupEnabled();