Repository navigation
fix: detect message links with linkifyjs instead of a backtracking regex - #750
Merged
Merged
Conversation
szuperaz
approved these changes
Nov 25, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 26, 2026
## [8.0.1](v8.0.0...v8.0.1) (2026-11-26) ### Bug Fixes * detect message links with linkifyjs instead of a backtracking regex ([#750](#750)) ([ed18cba](ed18cba))
|
🎉 This PR is included in version 8.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
🎯 Goal
MessageTextComponentused a regular expression to find links in message text. On some inputs that regex took a very long time, blocking rendering of the message list. This replaces it with linkifyjs, which scans text in linear time. It is the same librarystream-chat-reactuses, andstream-chatalready depends on it, so apps download nothing extra.🛠 Implementation details
find(text, 'url', { defaultProtocol: 'https' })is used both for the "does this message need parsing?" check and for wrapping links in anchors. The regex and its fallback for browsers without lookbehind support are removed.</>, so it never runs into the emoji wrapper markup that is added before link detection.http,https,ftpandfilelinks become anchors, so e-mail addresses andmailto:stay plain text, as before. Links without a scheme still gethttps://."in a link'shrefis escaped.linkifyjs@^4.4.0is added to the library's dependencies (and the ng-packagr allowlist). Versions before 4.4.0 are slow on some long inputs, and a spec covers that.Behaviour changes
*.internal,*.corp,*.local) and file names such asmain.tsare no longer linked.localhost:3000and URLs containing@(for examplehttps://medium.com/@user) are now linked.example.com.linksexample.com).🧪 Testing
mailto:aren't linked, a link right before an emoji, common link shapes.ng run stream-chat-angular:test: 867/867 passing.eslint,prettier --checkandng build stream-chat-angularare clean.