Skip to content
Myr

client-tree.tsx

This file

Path

apps/web/src/features/code/client-tree.tsx

29 lines · 897 bytes · TypeScript

Last changed by

Merge build/1211-code-browseroscabrielbefore adoptiona6808d3

History of this file

Take it

Merge branch 'build/904-web-code-browser'oscabrielbefore adoption06e2229

lines 1–2why, one step back
1/**
2 * The project's file tree, drawn in the browser only (`repo-tree.tsx`,

Merge build/1211-code-browseroscabrielbefore adoptiona6808d3

lines 3–5why, one step back
3 * `@pierre/trees`), in the rail's slot or the Files sheet. The server
4 * renders `fallback` (nothing), and the browser loads the tree after5 * hydration; the Worker bundles none of it, as `client-code.tsx` explains.

Merge branch 'build/904-web-code-browser'oscabrielbefore adoption06e2229

lines 6–29why, one step back
6 */
7import { ClientOnly } from "@tanstack/react-router";8import { lazy, Suspense } from "react";9import type { ReactNode } from "react";1011import type { RepoTreeProps } from "./repo-tree.tsx";1213const TreeLater = import.meta.env.SSR14 ? undefined15 : lazy(() => import("./repo-tree.tsx"));1617export const ClientTree = ({18 fallback = null,19 ...props20}: RepoTreeProps & { readonly fallback?: ReactNode }) =>21 TreeLater === undefined ? (22 fallback23 ) : (24 <ClientOnly fallback={fallback}>25 <Suspense fallback={fallback}>26 <TreeLater {...props} />27 </Suspense>28 </ClientOnly>29 );