Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
NicHaley committed Sep 30, 2023
1 parent c984491 commit c203bd9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,30 @@ const SideNav = ({ tree, params }: SideNavProps) => {
);
};

function isSinglePage(
page:
| {
title: string;
page: string;
}
| {
title: string;
pages: any[];
}
): page is {
title: string;
page: string;
} {
return (
(
page as {
title: string;
page: string;
}
).page !== undefined
);
}

const buildRecursiveTree = (
pages: Tree,
params: {
Expand All @@ -49,7 +73,7 @@ const buildRecursiveTree = (
pathname: string
) => {
return pages.map((page) => {
if (page.page) {
if (isSinglePage(page)) {
const isActive =
[params.tab, ...(params?.path ?? [])].join("/") === page.page;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ async function DocsPage({
);

if (currentSection.stack) {
const path = decodeURIComponent(
[params.tab, ...(params.path ?? [])].join("/")
);
const tree = await floeClient.tree.get(path, params.datasource);
const tree = await floeClient.tree.get(params.tab, params.datasource);

return (
<StackLayout tree={tree} params={params}>
Expand Down

0 comments on commit c203bd9

Please sign in to comment.