Skip to content

Commit 9c35ab7

Browse files
Merge pull request #396 from thoughtspot/SCAL-290499
SCAL-290499 Update URL handling to preserve subsection hashes in iframe
2 parents 0ac4314 + ce2c7b7 commit 9c35ab7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/components/DevDocTemplate/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ const DevDocTemplate: FC<DevDocTemplateProps> = (props) => {
251251
}
252252

253253
url.searchParams.set('pageid', e.data.params.pageid);
254+
const hash = e.data.subsection;
255+
if (hash) {
256+
url.hash = hash;
257+
}
254258
window.history.replaceState({}, '', url.toString());
255259
}
256260
}

src/components/VersionIframe/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ const VersionIframe: React.FC<VersionIframeProps> = ({
3434
} else if (mainUrlParams.has('pageId')) {
3535
url.searchParams.set('pageid', mainUrlParams.get('pageId'));
3636
}
37+
if (location?.hash) {
38+
url.hash = location?.hash;
39+
}
3740
url.searchParams.set('_iframe', '1');
3841
}
3942

4043
return url.toString();
41-
}, [iframeUrl, isDarkMode, location?.search]);
44+
}, [iframeUrl, isDarkMode, location?.search, location?.hash]);
4245

4346
return (
4447
<div className="version-iframe-container">

0 commit comments

Comments
 (0)