Skip to content

Fix maxLineDiffLength regression#451

Merged
amadeus merged 4 commits intomainfrom
amadeus/fix-tokenize-max-line-length
Mar 30, 2026
Merged

Fix maxLineDiffLength regression#451
amadeus merged 4 commits intomainfrom
amadeus/fix-tokenize-max-line-length

Conversation

@amadeus
Copy link
Copy Markdown
Member

@amadeus amadeus commented Mar 30, 2026

In a bunch of recent virtualization/worker pool logic, we ended up not passing this option through properly, causing diffs to be computed on extremely large lines, which isn't great.

Anyways, this brings back the check.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Mar 30, 2026 6:31am
pierrejs-docs Ready Ready Preview Mar 30, 2026 6:31am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores and propagates the maxLineDiffLength render option through the worker-pool and renderer pipeline so inline per-line diff decorations aren’t computed for extremely long changed lines (improving performance and avoiding regressions introduced by recent virtualization/worker changes).

Changes:

  • Plumbs maxLineDiffLength through RenderDiffOptions and worker rendering options (with default 1000).
  • Enforces a length guard in renderDiffWithHighlighter to skip inline line-diff computation when either side exceeds maxLineDiffLength.
  • Centralizes render-option equality (including maxLineDiffLength) via areDiffRenderOptionsEqual and uses it for cache validation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/diffs/src/worker/worker.ts Adds maxLineDiffLength to worker default render options.
packages/diffs/src/worker/types.ts Extends WorkerRenderingOptions with maxLineDiffLength.
packages/diffs/src/worker/WorkerPoolManager.ts Ensures maxLineDiffLength is included in pool render options and option-change detection.
packages/diffs/src/utils/renderDiffWithHighlighter.ts Skips inline line-diff decoration computation for very long changed lines using maxLineDiffLength.
packages/diffs/src/utils/areDiffRenderOptionsEqual.ts New helper to compare diff render options, including maxLineDiffLength.
packages/diffs/src/types.ts Adds maxLineDiffLength to RenderDiffOptions.
packages/diffs/src/renderers/DiffHunksRenderer.ts Uses areDiffRenderOptionsEqual and includes maxLineDiffLength in computed render options.
packages/diffs/src/index.ts Exports areDiffRenderOptionsEqual.
apps/docs/app/docs/WorkerPool/constants.ts Documents maxLineDiffLength as an optional WorkerPool render option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/diffs/src/utils/renderDiffWithHighlighter.ts
@amadeus amadeus merged commit 428061b into main Mar 30, 2026
8 checks passed
@amadeus amadeus deleted the amadeus/fix-tokenize-max-line-length branch March 30, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants