Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix potential null errors #2324

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions www/islands/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function setActiveLink(
`a[href="#${id}"]`,
) as HTMLElement;

if (tocLink === null) return;

tocLink.classList.add("active");

const rect = tocLink
Expand Down Expand Up @@ -62,8 +64,10 @@ export function TableOfContents({ headings }: TableOfContentsProps) {
const id = headings[i].id;
const tocLink = container.querySelector(
`a[href="#${id}"]`,
) as HTMLElement;
tocLink.classList.remove("active");
);
if (tocLink !== null) {
tocLink.classList.remove("active");
}
}

let activeIdx = visibleList.indexOf(true);
Expand Down
2 changes: 1 addition & 1 deletion www/routes/docs/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default function DocsPage(props: PageProps<Data>) {
<div class="flex gap-6 md:gap-8 xl:gap-[8%] flex-col xl:flex-row md:mx-8 lg:mx-16 2xl:mx-0 lg:justify-end">
<TableOfContents headings={headings} />

<div class="lg:order-1 min-w-0 max-w-3xl">
<div class="lg:order-1 min-w-0 max-w-3xl w-full">
<h1 class="text-4xl text-gray-900 tracking-tight font-bold md:mt-0 px-4 md:px-0 mb-4">
{page.title}
</h1>
Expand Down
Loading