Skip to content

refactor: Reduce message list mapping and ViewModel scope overhead#4857

Open
MohamadJaara wants to merge 2 commits into
mo/refactor/markdown-formating-while-mapping-conversaionsfrom
mo/refactor/markdown-formating-while-mapping-messages
Open

refactor: Reduce message list mapping and ViewModel scope overhead#4857
MohamadJaara wants to merge 2 commits into
mo/refactor/markdown-formating-while-mapping-conversaionsfrom
mo/refactor/markdown-formating-while-mapping-messages

Conversation

@MohamadJaara
Copy link
Copy Markdown
Member

Summary

  • Defer markdown parsing for text messages to the UI layer instead of doing it during message mapping
  • Cache mention display mapping across recompositions and lazily compute formatted message timestamps
  • Limit scoped audio and asset local path ViewModel keys to the visible message window plus a small prefetch buffer
  • Keep the currently playing audio message in scope while playback is active

Testing

  • Added regression coverage for deferring markdown document parsing

Avoid eagerly parsing markdown documents when mapping text messages, cache mention display mapping across recompositions, and lazily compute formatted message timestamps. Add coverage to ensure markdown parsing is deferred to the UI layer.
Limit audio and asset local path scoped view model keys to the visible
message window plus a small prefetch buffer instead of all loaded paging
items. Keep the currently playing audio message in scope while playback is
active.
@MohamadJaara MohamadJaara changed the base branch from develop to mo/refactor/markdown-formating-while-mapping-conversaions May 21, 2026 10:51
@MohamadJaara MohamadJaara requested review from Garzas, Copilot and saleniuk and removed request for Copilot May 21, 2026 10:51
@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.23%. Comparing base (47174d4) to head (3561303).

Files with missing lines Patch % Lines
...wire/android/mapper/RegularMessageContentMapper.kt 50.00% 1 Missing ⚠️
...e/android/ui/home/conversations/model/UIMessage.kt 83.33% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (75.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@                                      Coverage Diff                                      @@
##           mo/refactor/markdown-formating-while-mapping-conversaions    #4857      +/-   ##
=============================================================================================
+ Coverage                                                      51.19%   51.23%   +0.03%     
=============================================================================================
  Files                                                            612      612              
  Lines                                                          21172    21188      +16     
  Branches                                                        3421     3421              
=============================================================================================
+ Hits                                                           10839    10855      +16     
+ Misses                                                          9318     9316       -2     
- Partials                                                        1015     1017       +2     
Files with missing lines Coverage Δ
...ndroid/ui/home/conversations/model/MessageTypes.kt 14.28% <ø> (ø)
...wire/android/mapper/RegularMessageContentMapper.kt 17.12% <50.00%> (-1.40%) ⬇️
...e/android/ui/home/conversations/model/UIMessage.kt 40.68% <83.33%> (+0.74%) ⬆️

... and 3 files with indirect coverage changes


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 47174d4...3561303. Read the comment docs.

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

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.

1 participant