Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Fix profile picture flickering when sending post #316

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

FelberMartin
Copy link
Collaborator

Problem Description

After the introduction of the profile pictures in posts, there has been a bug where the profile picture would flicker when the user sends a new message (post or answer). Originally I thought this bug was related to the posts being falsely recomposed, so I looked into the recomposition of the posts and LazyColumns. While I found some optimizations on the way, the core issue turned out to not being related to recomposition at all (see changes section).

This closes #203

Changes

  • Bugfix: pass the author's imageUrl when first locally creating the post before sending it to the server.
  • Optimizations done on the way:
    • Use the default coil memoryCacheKey instead of defining it manually
    • Mark post interfaces as @Stable for compose optimizations. (All implementations of these interfaces are data classes and only used in a stable manner). This allows compose to skip recompositions more often
    • Moved the notification payload examples to a different directory as there where compilation problems

Steps for testing

User an account with a profile picture, do:

  • Go to any chat (or thread)
  • Send a new message
  • -> Notice that the profile picture no longer flickers 🥳

@FelberMartin FelberMartin added the ready for review This PR can be reviewed label Jan 18, 2025
@FelberMartin FelberMartin self-assigned this Jan 18, 2025
Copy link
Contributor

@julian-wls julian-wls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice change, good catch!
Just tested it and the flickering seems to be gone

@FelberMartin FelberMartin added ready to merge This PR can be merged and removed ready for review This PR can be reviewed labels Jan 23, 2025
@FelberMartin FelberMartin merged commit 0664faa into develop Jan 23, 2025
5 checks passed
@FelberMartin FelberMartin deleted the bugfix/communication/fix-post-recomposition branch January 23, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge This PR can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Post items get recomposed when new post is added
2 participants