perf: sohbet markdown lazy + marked client'tan çıktı, mermaid görünürlükte (Faz 4)
- markdown.tsx: blok bölme marked.lexer yerine çit-farkındalıklı boş satır bölücüsü — react-markdown'ın yanında ikinci tam parser (~460 KB paket) client'a inmiyordu artık gerekmiyor; memoized blok yapısı aynen korunur - markdown-lazy: react-markdown+remark zinciri (~215 KB) lazy; fallback aynı class'lı düz metin (stream'de flash/CLS yok), sohbet mount'unda preloadMarkdown ile chunk önden ısınır — /listem 1315->1133 KB eager JS - el-cizimi-sema: mermaid importu IntersectionObserver'a bağlandı (rootMargin 200px); şemalar hep fold altında, ~1 MB mount'ta inmiyor Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Markdown } from "./markdown"
|
||||
import { MarkdownLazy } from "./markdown-lazy"
|
||||
import type { MarkdownProps } from "./markdown"
|
||||
|
||||
export type MessageProps = {
|
||||
children: React.ReactNode
|
||||
@@ -48,7 +49,7 @@ export type MessageContentProps = {
|
||||
children: React.ReactNode
|
||||
markdown?: boolean
|
||||
className?: string
|
||||
} & React.ComponentProps<typeof Markdown> &
|
||||
} & MarkdownProps &
|
||||
React.HTMLProps<HTMLDivElement>
|
||||
|
||||
const MessageContent = ({
|
||||
@@ -63,9 +64,15 @@ const MessageContent = ({
|
||||
)
|
||||
|
||||
return markdown ? (
|
||||
<Markdown className={classNames} {...props}>
|
||||
// Fallback aynı class'lı düz metin: chunk inene dek CLS/flash olmadan
|
||||
// ham içerik görünür, sonra yerinde zenginleşir.
|
||||
<MarkdownLazy
|
||||
className={classNames}
|
||||
fallback={<div className={classNames}>{children}</div>}
|
||||
{...props}
|
||||
>
|
||||
{children as string}
|
||||
</Markdown>
|
||||
</MarkdownLazy>
|
||||
) : (
|
||||
<div className={classNames} {...props}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user