Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ import {
useState,
} from "react"
import scrollIntoView from "scroll-into-view-if-needed"
import { useActiveAnchor, useThemeConfig, Collapse } from "nextra-theme-docs"
import {
useActiveAnchor,
useThemeConfig,
Collapse,
ActiveAnchor,
} from "nextra-theme-docs"

import ArrowBarLeft from "@/app/conf/_design-system/pixelarticons/arrow-bar-left.svg?svgr"
import { Anchor } from "@/app/conf/_design-system/anchor"
Expand Down Expand Up @@ -249,7 +254,11 @@ function File({

// It is possible that the item doesn't have any route - for example an external link.
const active = item.route && [route, route + "/"].includes(item.route + "/")
const activeAnchor = useActiveAnchor()
/**
* we don't have this bug in staging, but this crashed in prod
* todo: clear this up when we investigate why that happened only in prod
*/
const activeAnchor = useActiveAnchor() as ActiveAnchor | null
const { setMenu } = useMenu()

if (item.type === "separator") {
Expand Down Expand Up @@ -277,7 +286,7 @@ function File({
className={cn(
classes.link,
'flex gap-2 before:opacity-25 before:content-["#"]',
activeAnchor[id]?.isActive
activeAnchor?.[id]?.isActive
? classes.active
: classes.inactive,
)}
Expand Down