Skip to content

Commit

Permalink
fix: reset prevActiveLink when unbinding AsideScrol (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukiniro authored Nov 20, 2023
1 parent 39fe6b5 commit 7fd7d3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-walls-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rspress/theme-default': patch
---

fix: reset prevActiveLink when unbinding AsideScrol
3 changes: 3 additions & 0 deletions packages/theme-default/src/logic/sideEffects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export function bindingAsideScroll() {

// eslint-disable-next-line consistent-return
return () => {
if (prevActiveLink) {
prevActiveLink.classList.remove('aside-active');
}
window.removeEventListener('scroll', throttledSetLink);
};
}
Expand Down

0 comments on commit 7fd7d3e

Please sign in to comment.