Skip to content

Commit e14f61d

Browse files
committed
remove side panel children
1 parent cd58128 commit e14f61d

File tree

2 files changed

+17
-29
lines changed

2 files changed

+17
-29
lines changed

src/ui/layout.tsx

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
import {
2-
ParentComponent,
3-
Show,
4-
children,
5-
Suspense,
6-
createEffect,
7-
} from "solid-js";
8-
import { useCurrentPageData } from "@kobalte/solidbase/client";
9-
10-
import { MainNavigation } from "~/ui/layout/main-navigation";
11-
import { MainHeader } from "./layout/main-header";
12-
import { Hero } from "./layout/hero";
13-
import { cache, createAsync, useMatch } from "@solidjs/router";
14-
import { DocsLayout } from "./docs-layout";
15-
import { SidePanel } from "./layout/side-panel";
16-
import { SUPPORTED_LOCALES } from "~/i18n/config";
17-
import { getValidLocaleFromPathname } from "~/i18n/helpers";
1+
import { ParentComponent, Show, Suspense } from "solid-js";
182
import {
193
coreTree,
204
routerTree,
@@ -26,6 +10,15 @@ import {
2610
metaEntries,
2711
} from "solid:collection";
2812
import { PathMatch } from "@solidjs/router";
13+
14+
import { MainNavigation } from "~/ui/layout/main-navigation";
15+
import { MainHeader } from "./layout/main-header";
16+
import { Hero } from "./layout/hero";
17+
import { query, createAsync, useMatch } from "@solidjs/router";
18+
import { DocsLayout } from "./docs-layout";
19+
import { SidePanel } from "./layout/side-panel";
20+
import { SUPPORTED_LOCALES } from "~/i18n/config";
21+
import { getValidLocaleFromPathname } from "~/i18n/helpers";
2922
import { useCurrentRouteMetaData } from "~/utils/route-metadata-helper";
3023

3124
const PROJECTS = ["solid-router", "solid-start", "solid-meta"] as const;
@@ -65,7 +58,7 @@ const getProjectFromUrl = (path: string) => {
6558
return null;
6659
};
6760

68-
const getDocsMetadata = cache(
61+
const getDocsMetadata = query(
6962
async (
7063
isFirstMatch: PathMatch | undefined,
7164
isI18nOrProject: PathMatch | undefined,
@@ -139,10 +132,6 @@ export const Layout: ParentComponent<{ isError?: boolean }> = (props) => {
139132
{ deferStream: true }
140133
);
141134

142-
const resolved = children(() => props.children);
143-
const sbPageData = useCurrentPageData();
144-
createEffect(() => console.log(sbPageData()));
145-
146135
return (
147136
<div class="relative dark:bg-slate-900 bg-slate-50">
148137
<Show when={entries()}>
@@ -174,16 +163,16 @@ export const Layout: ParentComponent<{ isError?: boolean }> = (props) => {
174163
keyed
175164
fallback={
176165
<article class="px-2 md:px-10 expressive-code-overrides overflow-y-auto">
177-
{resolved()}
166+
{props.children}
178167
</article>
179168
}
180169
>
181-
<Show when={!props.isError} fallback={<>{resolved()}</>}>
170+
<Show when={!props.isError} fallback={<>{props.children}</>}>
182171
<Suspense>
183172
<Show when={entries()}>
184173
{(data) => (
185174
<DocsLayout entries={data().entries}>
186-
{resolved()}
175+
{props.children}
187176
</DocsLayout>
188177
)}
189178
</Show>
@@ -194,7 +183,7 @@ export const Layout: ParentComponent<{ isError?: boolean }> = (props) => {
194183
<Show when={!props.isError}>
195184
<div class="hidden xl:block shrink-0 w-56 2xl:w-72 pr-4 prose prose-slate dark:prose-invert dark:text-slate-300">
196185
<div class="sticky top-[4.75rem] h-[calc(100vh-7rem)] overflow-y-auto custom-scrollbar">
197-
<SidePanel children={resolved()} />
186+
<SidePanel />
198187
</div>
199188
</div>
200189
</Show>

src/ui/layout/side-panel.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { Component, ResolvedChildren } from "solid-js";
21
import { Contribute } from "./contribute";
32
import { TableOfContents } from "./table-of-contents";
43

5-
export const SidePanel: Component<{ children: ResolvedChildren }> = (props) => {
4+
export const SidePanel = () => {
65
return (
76
<div class="h-full relative">
8-
<TableOfContents children={props.children} />
7+
<TableOfContents />
98
<Contribute />
109
</div>
1110
);

0 commit comments

Comments
 (0)