DOP-3610: relative anchor tag persisted on version change (#31)

This commit is contained in:
mmeigs 2023-04-04 16:50:53 -04:00 committed by GitHub
parent 176757f5ab
commit e161724135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,11 @@ const VersionSelectorComponent = ({
if (idx === selectedIdx) return setOpen(false);
// navigate to resource version spec
const selectedResourceVersionUrl = `${rootUrl}/${resourceVersion}`;
let selectedResourceVersionUrl = `${rootUrl}/${resourceVersion}`;
const anchorTagIdx = window.location.href.indexOf('#tag');
if (anchorTagIdx > -1) {
selectedResourceVersionUrl += window.location.href.slice(anchorTagIdx);
}
window.location.href = selectedResourceVersionUrl;
setSelectedIdx(idx);
return setOpen(false);