Skip to content

Conversation

@Eric-Guo
Copy link
Contributor

@Eric-Guo Eric-Guo commented Jan 6, 2026

Weixin Image_20260106152229_3556_8

TypeError: Cannot read properties of undefined (reading 'split')at zm.tokenize (http://tauri.localhost/assets/index-DYEnwwcr.js:1637:20)at zm.diff (http://tauri.localhost/assets/index-DYEnwwcF.js:1632:11499)at difflines (http://tauri.localhost/assets/index-DYEnwwcr.js:1636:118)at structuredPatch (http://tauri.localhost/assets/index-DyEnwwcr.js:1637:542)at createTwoFilesPatch (http://tauri.localhost/assets/index-DyEnwwcr.js:1641:59)at parseDiffFromFile (http://tauri.localhost/assets/index-DyEnwwcr.js:1645:2327)at FileDiff,render (http://tauri,localhost/assets/index-DYEnwwcE.is:1645:6918)at object.fn (http://tauri.localhost/assets/index-DyEnwwcr.j3:1696:12662)at runComputation(http://tauri.localhost/assets/index-DyEnwwCF.is:2:6697)at updateComputation (http://tauri.localhost/assets/index-DyEnwwcF.js:2:6598)

Fixed the diff renderer to normalize missing file contents so @pierre/diffs won’t crash when a diff has undefined text. The guard lives in packages/ui/src/components/diff.tsx and now coerces non-string before/after contents to "" before computing cache keys and rendering, which prevents the split on undefined seen in the stack trace.

…e/diffs won’t crash when a diff has undefined text. The guard lives in packages/ui/src/components/diff.tsx and now coerces non-string before/after contents to "" before computing cache keys and rendering, which prevents the split on undefined seen in the stack trace.
Copilot AI review requested due to automatic review settings January 6, 2026 07:36
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Copy link
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

This PR fixes a crash in the diff renderer when file contents are undefined. The error occurred in the @pierre/diffs library when attempting to call .split() on undefined text during diff tokenization.

Key Changes:

  • Added type guards to normalize undefined/null file contents to empty strings before processing
  • Updated both the contents and cacheKey computation to use the normalized values

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

@adamdotdevin adamdotdevin merged commit 4ecb305 into anomalyco:dev Jan 6, 2026
9 checks passed
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