From ce2c7b7d7b201b32e2e6ce118673a2498ba66430 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Tue, 13 Jan 2026 10:43:01 +0530 Subject: [PATCH] SCAL-290499 Update URL handling to preserve subsection hashes in iframe --- src/components/DevDocTemplate/index.tsx | 4 ++++ src/components/VersionIframe/index.tsx | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index be6ea8441..ad9f331ca 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -251,6 +251,10 @@ const DevDocTemplate: FC = (props) => { } url.searchParams.set('pageid', e.data.params.pageid); + const hash = e.data.subsection; + if (hash) { + url.hash = hash; + } window.history.replaceState({}, '', url.toString()); } } diff --git a/src/components/VersionIframe/index.tsx b/src/components/VersionIframe/index.tsx index fa818aaae..e6e23eaa3 100644 --- a/src/components/VersionIframe/index.tsx +++ b/src/components/VersionIframe/index.tsx @@ -34,11 +34,14 @@ const VersionIframe: React.FC = ({ } else if (mainUrlParams.has('pageId')) { url.searchParams.set('pageid', mainUrlParams.get('pageId')); } + if (location?.hash) { + url.hash = location?.hash; + } url.searchParams.set('_iframe', '1'); } return url.toString(); - }, [iframeUrl, isDarkMode, location?.search]); + }, [iframeUrl, isDarkMode, location?.search, location?.hash]); return (