Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-md committed Oct 8, 2024
1 parent 6a0f98a commit 034eadf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/mdx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const useCurrentTocIndex: (
}
}
if (active != null) {
const nextHeading = _headings[_headings.indexOf(active as Heading) + 1]
const nextHeading = _headings[_headings.indexOf(active) + 1]
const nextHeadingNode = document.getElementById(
nextHeading?.link.slice(1) ?? ''
)
Expand All @@ -166,9 +166,7 @@ export const useCurrentTocIndex: (
nextHeadingNode.offsetTop - navHeight <
document.documentElement.scrollTop + window.innerHeight
setCurrentIndex(
(isNextHeadingInView
? (nextHeading?.link ?? '')
: (active?.link ?? '')) as string
isNextHeadingInView ? (nextHeading?.link ?? '') : (active?.link ?? '')
)
} else setCurrentIndex(_headings[0]?.children?.[0]?.link ?? '')
}, [headings, navHeight])
Expand Down

0 comments on commit 034eadf

Please sign in to comment.