client-tree.tsx
This file
Path
apps/web/src/features/code/client-tree.tsx
23 lines · 600 bytes · TypeScript
Last changed by
Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72
History of this fileTake it
123456789101112131415161718192021222324import { ClientOnly } from "@tanstack/react-router";import { lazy, Suspense } from "react";import type { ReactNode } from "react";
import type { RepoTreeProps } from "./repo-tree.tsx";
const TreeLater = import.meta.env.SSR ? undefined : lazy(() => import("./repo-tree.tsx"));
export const ClientTree = ({ fallback = null, ...props}: RepoTreeProps & { readonly fallback?: ReactNode }) => TreeLater === undefined ? ( fallback ) : ( <ClientOnly fallback={fallback}> <Suspense fallback={fallback}> <TreeLater {...props} /> </Suspense> </ClientOnly> );