refactor(ui): isolate session components (#33670)

This commit is contained in:
Victor Navarro 2026-06-24 16:56:09 +02:00 committed by GitHub
commit 04c1730c90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
126 changed files with 294 additions and 142 deletions

View file

@ -0,0 +1,22 @@
import type { MarkdownToken } from "./markdown-worker-protocol"
export type RenderedCodeState = {
language: string
generation: number
stableCount: number
unstable: MarkdownToken[]
raw: string
}
export function shouldResetCodeTokens(
previous: RenderedCodeState | undefined,
next: { language: string; generation: number; stableCount: number; raw: string },
) {
return (
!previous ||
previous.language !== next.language ||
previous.generation !== next.generation ||
next.stableCount < previous.stableCount ||
!next.raw.startsWith(previous.raw)
)
}