Skip to content

Commit 416f673

Browse files
addressed review comments
1 parent 38a3213 commit 416f673

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/rapidoc.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -566,19 +566,6 @@ 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-
582569
// Public Method
583570
async loadSpec(specUrl) {
584571
if (!specUrl) {
@@ -587,7 +574,17 @@ export default class RapiDoc extends LitElement {
587574

588575
this.matchPaths = '';
589576
try {
590-
this.resetDoc();
577+
this.resolvedSpec = null;
578+
this.loading = true;
579+
this.loadFailed = false;
580+
this.requestUpdate();
581+
if (this.renderStyle === 'read' || this.renderStyle === 'focused') {
582+
// Remove the previous active state from navbar
583+
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');
584+
if (oldNavEl) {
585+
oldNavEl.classList.remove('active');
586+
}
587+
}
591588
const spec = await ProcessSpec(
592589
specUrl,
593590
this.sortTags === 'true',

0 commit comments

Comments
 (0)