Skip to content

Commit 38a3213

Browse files
- Fixed navbar active path/tag/link
- Fixed loading state when spec changes Signed-off-by: Dharmendra <[email protected]>
1 parent bc22f54 commit 38a3213

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/rapidoc.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,19 @@ export default class RapiDoc extends LitElement {
566566
}
567567
}
568568

569+
resetDoc() {
570+
this.resolvedSpec = null;
571+
this.loading = true;
572+
this.loadFailed = false;
573+
this.requestUpdate();
574+
575+
// Remove the previous active tag
576+
const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active');
577+
if (oldNavEl) {
578+
oldNavEl.classList.remove('active');
579+
}
580+
}
581+
569582
// Public Method
570583
async loadSpec(specUrl) {
571584
if (!specUrl) {
@@ -574,8 +587,7 @@ export default class RapiDoc extends LitElement {
574587

575588
this.matchPaths = '';
576589
try {
577-
this.loading = true;
578-
this.loadFailed = false;
590+
this.resetDoc();
579591
const spec = await ProcessSpec(
580592
specUrl,
581593
this.sortTags === 'true',

0 commit comments

Comments
 (0)