Fix(app): @pierre/diffs will crash when a diff has undefined text #7059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.