Skip to content

Optimize composer and chat list Compose hot paths#1506

Merged
mubarakcoded merged 3 commits into
masterfrom
sweep/1498-1503-1504-compose-performance
Jul 17, 2026
Merged

Optimize composer and chat list Compose hot paths#1506
mubarakcoded merged 3 commits into
masterfrom
sweep/1498-1503-1504-compose-performance

Conversation

@mubarakcoded

@mubarakcoded mubarakcoded commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stabilize reply-preview mention resolution and cache reply body projection
  • move emoji filtering to a cancellable Default-dispatcher producer
  • isolate chat-list scroll observation and memoize per-row search classification
  • add source coverage for the optimized Compose paths

Verification

  • git diff --check
  • Local Gradle tests intentionally not run for this fast sweep; CI will validate the branch.

Closes #1498
Closes #1503
Closes #1504


Open in Stage

Summary by CodeRabbit

  • Performance

    • Improved chat list search by reusing a single normalized query for per-item matching, and refined the “jump to top” button to update only when scroll position changes.
    • Updated the emoji picker to run searches asynchronously off the main UI thread and prevent stale results from appearing.
    • Reduced unnecessary recomputation in the reply preview by caching the projected reply text and resolved mention display name.
  • Tests

    • Added hot-path coverage tests to guard optimized behavior for chat search, emoji search, and reply preview.

@stage-review

stage-review Bot commented Jul 17, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Optimize chat list scroll and search performance
2 Stabilize composer reply preview and mention resolution
3 Move emoji search to background dispatcher
4 Add coverage for optimized Compose hot paths
Open in Stage

Chapters generated by Stage for commit 0f47520 on Jul 17, 2026 11:57am UTC.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1990056d-ea2f-4068-8944-105d1c62d601

📥 Commits

Reviewing files that changed from the base of the PR and between 1e0c5fa and 0f47520.

📒 Files selected for processing (1)
  • app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt

Walkthrough

Changes

The PR memoizes reply preview computations and chat search data, moves emoji filtering off the composition thread, and replaces chat scroll-derived state with snapshotFlow. Source-based tests verify these Compose hot-path patterns.

Compose hot-path optimizations

Layer / File(s) Summary
Chat search and scroll observation
app/src/main/java/dev/ipf/whitenoise/android/ui/chats/ChatsScreen.kt, app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt
Chat search uses a memoized Locale.ROOT needle, row matching reuses it, and jump-to-top visibility observes distinct scroll-index changes through snapshotFlow.
Reply preview memoization
app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/composer/ComposerBar.kt, app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt
Reply body projection and mention display-name resolution use remembered values before being passed to ReplyPreviewCard.
Asynchronous emoji search
app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/composer/EmojiPicker.kt, app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt
Emoji results use produceState, return no results for blank queries, and run searches on Dispatchers.Default; source assertions cover the execution pattern.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main Compose hot-path optimizations in composer and chat list.
Linked Issues check ✅ Passed The changes address #1498, #1503, and #1504 by memoizing reply rendering, moving emoji search off-composition, and isolating chat scroll/search work.
Out of Scope Changes check ✅ Passed The added test coverage supports the same hot-path fixes and no unrelated code changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sweep/1498-1503-1504-compose-performance

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Preview APK for PR #1506

Home-screen label: 1506 White Noise with the blueprint launcher icon — installs side-by-side with the production and staging apps.

Install directly — one tap, no GitHub sign-in (public, content-addressed .apk). ARM64 only.

Every push to this PR rebuilds and updates this comment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt`:
- Around line 12-15: Update reply-branch extraction in
ComposeHotPathCoverageTest to locate both the “replyingTo != null” and live
`@-mention` picker markers explicitly, requiring each marker to exist before
slicing. Use the validated marker positions to extract only the intended branch,
preserving the existing assertions and failing closed when either marker is
missing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f2a0ce81-a28d-4b71-a4da-f717372fc842

📥 Commits

Reviewing files that changed from the base of the PR and between c824658 and 1e0c5fa.

📒 Files selected for processing (3)
  • app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/composer/ComposerBar.kt
  • app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/composer/EmojiPicker.kt
  • app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/composer/ComposerBar.kt
  • app/src/main/java/dev/ipf/whitenoise/android/ui/conversation/composer/EmojiPicker.kt

Comment thread app/src/test/java/dev/ipf/whitenoise/android/ui/ComposeHotPathCoverageTest.kt Outdated
@mubarakcoded
mubarakcoded merged commit 26fb828 into master Jul 17, 2026
4 checks passed
@mubarakcoded
mubarakcoded deleted the sweep/1498-1503-1504-compose-performance branch July 17, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment