Fix infinite recomposition in Text.foregroundStyle(LinearGradient())#438
Open
dfabulich wants to merge 1 commit into
Open
Fix infinite recomposition in Text.foregroundStyle(LinearGradient())#438dfabulich wants to merge 1 commit into
Text.foregroundStyle(LinearGradient())#438dfabulich wants to merge 1 commit into
Conversation
Contributor
Author
|
I think this was caused by #424 … not sure if I'm undoing your fix in this PR. But… what did it fix, exactly? Was there a bug you were fixing there that I could repro, and test that I didn't just re-break it? |
Member
|
I think you are right. I've updated the rationale for that earlier (admittedly minimally tested) fix at: #424 (comment) I had intended to have the brush itself be remember'd — I'm not sure how I missed that. I've confirmed that your fix also fixes the original bug I was seeing. |
marcprux
reviewed
May 19, 2026
| @Composable override func asBrush(opacity: Double, animationContext: ComposeContext?) -> Brush? { | ||
| let stops = gradient.colorStops(opacity: opacity) | ||
| return LinearGradientShaderBrush(colorStops: stops, startPoint: startPoint, endPoint: endPoint) | ||
| return remember(gradient, startPoint, endPoint, opacity) { |
Member
There was a problem hiding this comment.
Could you also add remember(…) to the two places we create a RadialGradientShaderBrush?
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.
Fixes #437
Skip Pull Request Checklist:
swift testNot required
Repro infinite recomposition with
.foregroundStyle(LinearGradient())skipapp-showcase#107Cursor tracked this down and fixed it. I manually tested it with skiptools/skipapp-showcase#107 in Showcase Lite mode.