Skip to content

The agent that grows with you

docs(desktop): windowed diff panels mount only visible rows but still tokenize the whole diff

Teknium83f3fd4b8dae
diff --git a/apps/desktop/src/components/chat/diff-lines.test.tsx b/apps/desktop/src/components/chat/diff-lines.test.tsx
index 4b65b83c844..f3fd5c3e69e 100644
--- a/apps/desktop/src/components/chat/diff-lines.test.tsx
+++ b/apps/desktop/src/components/chat/diff-lines.test.tsx
@@ -56,8 +56,9 @@ function renderQuietly(node: Parameters<typeof render>[0]) {
describe('FileDiffPanel survives a failed lazy syntax-diff chunk', () => {
it('degrades to the plain colored diff instead of taking down the surrounding boundary', async () => {
- // Highlighting waits until the card is on screen, and jsdom never reports an intersection:
- // without an observer the card highlights at once, so the failing chunk really mounts.
+ // Highlighting waits until the card is on screen, and the test setup's inert IntersectionObserver
+ // (jsdom has none) never reports one: without an observer the card highlights at once, so the
+ // failing chunk really mounts.
vi.stubGlobal('IntersectionObserver', undefined)
const { container } = renderQuietly(
diff --git a/apps/desktop/src/components/chat/diff-lines.tsx b/apps/desktop/src/components/chat/diff-lines.tsx
index 2cf45ba74c7..c1f03f99ce5 100644
--- a/apps/desktop/src/components/chat/diff-lines.tsx
+++ b/apps/desktop/src/components/chat/diff-lines.tsx
@@ -611,13 +611,14 @@ export function FileDiffPanel({
// Edit-tool cards open their diff by default, so a session full of file edits
// used to tokenize every diff in the loaded window on each switch (seconds of
// Shiki on the click path). The compact card keeps the plain colored rows
- // until it is first on screen; the windowed body already highlights only
- // the rows it mounts.
+ // until it is first on screen. Windowed panels are unchanged: they mount only
+ // the visible rows but still tokenize the whole diff.
const boxRef = React.useRef<HTMLDivElement>(null)
const seen = useSeenOnce(boxRef, canHighlight && !windowed)
// Windowed: we own fixed-height rows and render only the visible chunks, so a
- // large diff never mounts (or Shiki-highlights) every line. Compact tool cards
+ // large diff never mounts every line (TokenizedDiffBody still tokenizes the
+ // whole diff once). Compact tool cards
// are small/clamped, so they let Shiki own the rows (SyntaxDiff).
const windowedBody = canHighlight ? (
<TokenizedDiffBody