feat(app): make session timelines much faster AND without flicker or scroll jumps (#32331)

This commit is contained in:
Luke Parker 2026-06-16 18:53:57 +02:00 committed by GitHub
commit 3b811bd019
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 2824 additions and 845 deletions

View file

@ -0,0 +1,32 @@
import { expect, test } from "bun:test"
import { shouldResetCodeTokens } from "./markdown-code-state"
const previous = {
language: "ts",
generation: 1,
stableCount: 3,
unstable: [],
raw: "```ts\nconst x = 1\n```",
}
test("resets tokens for a non-prefix replacement with the same generation and token count", () => {
expect(
shouldResetCodeTokens(previous, {
language: "ts",
generation: 1,
stableCount: 3,
raw: "```ts\nlet y = 2\n```",
}),
).toBe(true)
})
test("retains tokens for an append-only streaming update", () => {
expect(
shouldResetCodeTokens(previous, {
language: "ts",
generation: 1,
stableCount: 4,
raw: `${previous.raw}\nmore`,
}),
).toBe(false)
})