MCPcopy Create free account
hub / github.com/fontsource/fontsource / usePageTree

Function usePageTree

website/app/components/docs/LeftSidebar.tsx:22–32  ·  view source on GitHub ↗
(tree?: PageTree.Root)

Source from the content-addressed store, hash-verified

20}
21
22const usePageTree = (tree?: PageTree.Root) => {
23 const matches = useMatches();
24 const serialized = matches.find((match) => match.id === 'routes/docs')
25 ?.data as LayoutData | undefined;
26
27 return useMemo(() => {
28 if (tree) return tree;
29 if (!serialized?.pageTree) return undefined;
30 return deserializePageTree(serialized.pageTree);
31 }, [serialized?.pageTree, tree]);
32};
33
34const nodeKey = (node: PageTree.Node) =>
35 node.$id ??

Callers 1

LeftSidebarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected