diff --git a/packages/trpc-panel/src/react-app/Root.tsx b/packages/trpc-panel/src/react-app/Root.tsx index 946e8fe..c230470 100644 --- a/packages/trpc-panel/src/react-app/Root.tsx +++ b/packages/trpc-panel/src/react-app/Root.tsx @@ -30,8 +30,8 @@ export function RootComponent({ }) { return ( - - + + @@ -41,8 +41,8 @@ export function RootComponent({ - - + + ); } diff --git a/packages/trpc-panel/src/react-app/components/CollapsableSection.tsx b/packages/trpc-panel/src/react-app/components/CollapsableSection.tsx index a9c2a17..2530113 100644 --- a/packages/trpc-panel/src/react-app/components/CollapsableSection.tsx +++ b/packages/trpc-panel/src/react-app/components/CollapsableSection.tsx @@ -1,14 +1,22 @@ import React, { MutableRefObject, ReactNode, useEffect, useRef } from "react"; import { Chevron } from "@src/react-app/components/Chevron"; -import { useSiteNavigationContext } from "@src/react-app/components/contexts/SiteNavigationContext"; +import { + collapsables, + useCollapsableIsShowing, + useSiteNavigationContext, +} from "@src/react-app/components/contexts/SiteNavigationContext"; import { backgroundColor, solidColorBg, solidColorBorder, } from "@src/react-app/components/style-utils"; -export type ColorSchemeType = "query" | "mutation" | "router" | "neutral" | "subscription"; - +export type ColorSchemeType = + | "query" + | "mutation" + | "router" + | "neutral" + | "subscription"; export function CollapsableSection({ titleElement, fullPath, @@ -24,8 +32,9 @@ export function CollapsableSection({ isRoot?: boolean; focusOnScrollRef?: MutableRefObject; }) { - const { has, togglePath, scrollToPathIfMatches } = useSiteNavigationContext(); - const shown = has(fullPath); + const { scrollToPathIfMatches } = useSiteNavigationContext(); + const shown = useCollapsableIsShowing(fullPath); + const containerRef = useRef(null); useEffect(() => { if (shown && containerRef.current) { @@ -59,7 +68,7 @@ export function CollapsableSection({ > {collapsable ? (