Fix infinite loop on plain-text diffs#526
Merged
amadeus merged 1 commit intopierrecomputer:mainfrom Apr 19, 2026
Merged
Conversation
|
@dimfeld is attempting to deploy a commit to the Pierre Computer Company Team on Vercel. A member of the Team first needs to authorize it. |
|
I am experiencing the same issue: #534 that is being fixed by this PR. Alternative fix might be by adding the 'text' and 'ansi' to the list of |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
|
Great catch, and thanks for the fix, will merge when everything passes! 🙏 Also sorry, totally missed this PR the other day when you opened it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Rendering a diff with language "text" or "ansi" would cause an infinite loop, because those languages are skipped in
getSharedHighlighterand so never become attached.This change updates
areLanguagesAttachedto always return true for those languages, to match the corresponding special treatment of those languages in other places.Motivation & Context
Infinite loop when rendering "text" diffs. I specifically saw this on a
.gitignorediff in my project using the Vanilla JS API. This diff had no attached language but the autodetection chose "text" as the language.Excerpt of the stack trace:
Type of changes
first discussed with the dev team and they should be aware that this PR is
being opened
You must have first discussed with the dev team and they should be aware
that this PR is being opened
Checklist
contributing guidelines
bun run lint)bun run format)bun run diffs:test) -- Usedcd packages/diffs && bun run testsince diffs:test command doesn't seem to exist.How was AI used in generating this PR
Fed the above stack trace into Codex, which diagnosed the error and generated the fix and tests.
I manually reviewed all changes and verified that it fixes the problem in my application.
Related issues