Skip to content

fix: stabilize message media loading [WPB-18914]#4687

Merged
MohamadJaara merged 18 commits intodevelopfrom
fix/stabilize-message-media-loading
Apr 9, 2026
Merged

fix: stabilize message media loading [WPB-18914]#4687
MohamadJaara merged 18 commits intodevelopfrom
fix/stabilize-message-media-loading

Conversation

@Garzas
Copy link
Copy Markdown
Contributor

@Garzas Garzas commented Apr 1, 2026

https://wearezeta.atlassian.net/browse/WPB-18914


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

  • Opening a conversation with a large backlog of missed messages could leave the message list in an unstable loading state.
  • Instead of showing a single loading phase, the conversation rendered messages progressively one by one, with many per-message loading indicators visible in the list.
  • Media loading inside the conversation was tightly coupled to the message list read model, which also increased the risk of visual churn while messages were being loaded.

Causes (Optional)

  • The conversation paging query depended on local asset cache data through MessageDetailsView, so writes to the Asset table could invalidate the message list while the conversation was loading.
  • Local asset paths were propagated through the message read model, even though they represent local runtime/cache state rather than stable message data.
  • Some media UI flows relied on local asset path data being present directly in the message model instead of resolving it on demand for the specific item.

Solutions

  • Removed the dependency between conversation message paging and local asset cache writes by detaching MessageDetailsView from the Asset table and adding a forward DB migration.
  • Removed local asset path from the message read model and stopped treating it as part of the main message state.
  • Switched media components to resolve local asset paths on demand for the specific message item instead of loading them through the whole conversation list model.
  • Updated image/video/audio-related flows so they no longer rely on local asset path being embedded in the message read model.
  • Fixed follow-up media regressions caused by this refactor, including item flicker/blinking and concurrent temporary file collisions during asset downloads.

Comment thread app/src/main/kotlin/com/wire/android/media/audiomessage/AudioMessageViewModel.kt Outdated
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Apr 7, 2026
@pull-request-size
Copy link
Copy Markdown

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@pull-request-size pull-request-size bot added size/L and removed size/XL labels Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

@Garzas looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
9ccecabb04742ec0afa30babe9925bea7313a17c f30c54ab5b1b985739ecbde76eeb11c7a4c7ca74

Is this intentional?

@Garzas Garzas requested a review from saleniuk April 8, 2026 08:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

@Garzas looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
9ccecabb04742ec0afa30babe9925bea7313a17c f30c54ab5b1b985739ecbde76eeb11c7a4c7ca74

Is this intentional?

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 12.50000% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.71%. Comparing base (76948f5) to head (456c97e).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...ersations/messages/item/AssetLocalPathViewModel.kt 0.00% 28 Missing ⚠️
...dia/audiomessage/ConversationAudioMessagePlayer.kt 0.00% 3 Missing ⚠️
...ui/home/conversations/AudioMessageScopeResolver.kt 0.00% 2 Missing ⚠️
...wire/android/mapper/RegularMessageContentMapper.kt 0.00% 1 Missing ⚠️
...rsations/messages/ConversationMessagesViewModel.kt 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4687      +/-   ##
===========================================
- Coverage    49.77%   49.71%   -0.07%     
===========================================
  Files          600      602       +2     
  Lines        20588    20610      +22     
  Branches      3283     3288       +5     
===========================================
- Hits         10248    10246       -2     
- Misses        9371     9398      +27     
+ Partials       969      966       -3     
Files with missing lines Coverage Δ
...ndroid/media/audiomessage/AudioMessageViewModel.kt 81.13% <100.00%> (+0.36%) ⬆️
...id/ui/home/conversations/messages/QuotedMessage.kt 0.00% <ø> (ø)
...conversations/messages/item/SwipeableMessageBox.kt 0.00% <ø> (ø)
...ndroid/ui/home/conversations/model/MessageTypes.kt 25.00% <ø> (ø)
...e/android/ui/home/conversations/model/UIMessage.kt 39.43% <ø> (-0.07%) ⬇️
...tions/model/messagetypes/audio/AudioMessageType.kt 0.00% <ø> (ø)
...wire/android/mapper/RegularMessageContentMapper.kt 18.51% <0.00%> (+0.19%) ⬆️
...rsations/messages/ConversationMessagesViewModel.kt 67.39% <50.00%> (+0.72%) ⬆️
...ui/home/conversations/AudioMessageScopeResolver.kt 0.00% <0.00%> (ø)
...dia/audiomessage/ConversationAudioMessagePlayer.kt 67.79% <0.00%> (ø)
... and 1 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 76948f5...456c97e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbakhtiarov sbakhtiarov self-requested a review April 9, 2026 07:41
@MohamadJaara MohamadJaara enabled auto-merge April 9, 2026 07:51
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
13.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@MohamadJaara MohamadJaara added this pull request to the merge queue Apr 9, 2026
@MohamadJaara MohamadJaara removed this pull request from the merge queue due to a manual request Apr 9, 2026
@MohamadJaara MohamadJaara merged commit 618d223 into develop Apr 9, 2026
16 of 17 checks passed
@MohamadJaara MohamadJaara deleted the fix/stabilize-message-media-loading branch April 9, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants