Skip to content

Commit f7ea602

Browse files
committed
improve variable name for redability
1 parent 0114e5b commit f7ea602

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rapidoc.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,10 +728,12 @@ export default class RapiDoc extends LitElement {
728728
// On first time Spec load, try to navigate to location hash if provided
729729
const locationHash = window.location.hash?.substring(1);
730730
if (locationHash) {
731+
const regEx = new RegExp(`^${this.routePrefix}`, 'i');
732+
const elementId = window.location.hash.replace(regEx, '');
731733
if (this.renderStyle === 'view') {
732-
this.expandAndGotoOperation(locationHash, true, true);
734+
this.expandAndGotoOperation(elementId, true, true);
733735
} else {
734-
this.scrollTo(locationHash);
736+
this.scrollTo(elementId);
735737
}
736738
} else if (this.renderStyle === 'focused') {
737739
const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0]?.paths[0];

0 commit comments

Comments
 (0)