This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Fix avatar scaling issue when expanding the header in the Avatar tab#108
Merged
AdamGrzybkowski merged 3 commits intotrunkfrom Aug 13, 2025
Merged
Fix avatar scaling issue when expanding the header in the Avatar tab#108AdamGrzybkowski merged 3 commits intotrunkfrom
AdamGrzybkowski merged 3 commits intotrunkfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an avatar scaling animation issue that occurs when expanding the header in the Avatar tab after selecting a new image. The problem was caused by multiple recompositions triggering the oldImageKey callback repeatedly, which interfered with the scaling animation for non-cached images.
- Fixed callback handling to only update
oldImageKeywhen the value actually changes - Simplified
GravatarAvatarWithShadowcomponent by removing unnecessary state management - Maintained the core functionality of showing placeholder until new avatar loads
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| GravatarAvatarWithShadow.kt | Simplified component by removing loading state tracking and Box wrapper |
| AsyncImageWithCachePlaceholder.kt | Fixed callback logic to prevent unnecessary oldImageKey updates |
...main/kotlin/com/gravatar/app/homeUi/presentation/home/components/GravatarAvatarWithShadow.kt
Outdated
Show resolved
Hide resolved
...otlin/com/gravatar/app/homeUi/presentation/home/components/AsyncImageWithCachePlaceholder.kt
Show resolved
Hide resolved
1998fbf to
ddb111b
Compare
etoledom
approved these changes
Aug 13, 2025
Contributor
etoledom
left a comment
There was a problem hiding this comment.
Nice! The issue is not reproducible any longer 🎉
ddb111b to
faae939
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
There's a problem with the avatar scaling animation when expanding the header after the image is selected. The avatar isn't scaling properly (only the outer component).
I noticed the issue would only happen when the image was not in the cache. Selecting an image that was already selected before would work just fine. The callback that sets the
oldImageKeyis invoked multiple times, so my guess is that it's related to extra recompositions... but not 100% sure.Adding a check and only setting the
oldImageKeyto a new value seems to solve the issue.Additionally, I've simplified the
GravatarAvatarWithShadowcode. The behavior should still be the same: a placeholder visible at all times, when loading a new avatar, the old one should stay visible until the new one is loaded.Testing Steps