Fix updateHash function throwing errors when there are no headings visible at the screen (#125)
This commit is contained in:
parent
a2f056f536
commit
ec12e57ff5
1 changed files with 2 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ const updateHash = (data: Data) => {
|
|||
})
|
||||
.filter((section) => section.bottom > 0);
|
||||
|
||||
if (distancesToHeadingBottom.length === 0) return;
|
||||
|
||||
const currentSection = distancesToHeadingBottom.reduce((previous, current) =>
|
||||
previous.bottom < current.bottom ? previous : current
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue