fix: move URL regex off main thread in MessagingScreen#468
Merged
torlando-tech merged 1 commit intomainfrom Feb 15, 2026
Merged
fix: move URL regex off main thread in MessagingScreen#468torlando-tech merged 1 commit intomainfrom
torlando-tech merged 1 commit intomainfrom
Conversation
Replace synchronous Patterns.WEB_URL.matcher() in remember block with LaunchedEffect + withContext(Dispatchers.Default) to prevent potential UI jank on long messages with many URLs (COLUMBA-3C). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Greptile SummaryMoves the
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Composition (Main Thread)
participant S as State (annotatedText)
participant BG as Dispatchers.Default
participant UI as Text Composable
C->>S: remember(text, linkColor) → plain AnnotatedString
S->>UI: Render plain text (no links)
C->>BG: LaunchedEffect → withContext(Dispatchers.Default)
BG->>BG: Patterns.WEB_URL.matcher(text)
BG->>BG: buildAnnotatedString with link styles
BG->>S: Update annotatedText with linkified result
S->>UI: Recompose with clickable links
Note over UI: pointerInput restarts with new annotatedText key
Last reviewed commit: b111c78 |
Contributor
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
Patterns.WEB_URL.matcher()regex computation off the main thread inLinkifiedMessageTextcomposablerememberblock withLaunchedEffect+withContext(Dispatchers.Default)for background regex executionContext
Sentry issue COLUMBA-3C ("Regex on Main Thread") flagged main-thread regex work. While the Sentry report was triggered by SDK internals, the
Patterns.WEB_URL.matcher(text)call inLinkifiedMessageTextis a legitimate main-thread regex that could cause UI jank on long messages with many URLs.Test plan
./gradlew :app:compileNoSentryDebugKotlin🤖 Generated with Claude Code