diff --git a/src/scripts/updateHash.ts b/src/scripts/updateHash.ts index fa44b77..412000e 100644 --- a/src/scripts/updateHash.ts +++ b/src/scripts/updateHash.ts @@ -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 );