Skip to content

Commit 3130237

Browse files
authored
Merge pull request #379 from Dharmendra205111014/bugfix/reset-state-on-spec-change
- Fixed navbar active path/tag/link
2 parents bc22f54 + 416f673 commit 3130237

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/rapidoc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,17 @@ export default class RapiDoc extends LitElement {
574574

575575
this.matchPaths = '';
576576
try {
577+
this.resolvedSpec = null;
577578
this.loading = true;
578579
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+
}
579588
const spec = await ProcessSpec(
580589
specUrl,
581590
this.sortTags === 'true',

0 commit comments

Comments
 (0)