Fix AsyncImagePainter not updating placeholder/error/fallback when transform changes#3510
Open
shamana-s wants to merge 1 commit into
Open
Fix AsyncImagePainter not updating placeholder/error/fallback when transform changes#3510shamana-s wants to merge 1 commit into
shamana-s wants to merge 1 commit into
Conversation
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
Fixes an issue where updating the
placeholder,error, orfallbackpainter afterAsyncImagePainterhas already entered the corresponding state does not update the displayed painter.The root cause is that the
transformcallback is updated during recomposition, but it is only applied when a new image loading state is emitted. If only the transform changes, the current state is never re-transformed.This change stores the latest untransformed state and reapplies the transform whenever the
transformcallback changes, without restarting the image request.Reproduction
Before
The displayed fallback painter remained red indefinitely.
After
The displayed fallback painter updates to blue immediately after recomposition.
Visual demonstration
The video below shows the fallback painter updating from red to blue after the
fallbackparameter changes, without restarting the image request.Screen_recording_20260716_144515.mp4
Fixes #1908
Related: #3477