Skip to content

perf(compose): optimize chat workspace recompositions#241

Merged
yacosta738 merged 2 commits into
mainfrom
perf/optimize-compose-ui-12071071982286545964
Mar 18, 2026
Merged

perf(compose): optimize chat workspace recompositions#241
yacosta738 merged 2 commits into
mainfrom
perf/optimize-compose-ui-12071071982286545964

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

Implemented two UI performance optimizations in the Compose Multiplatform chat workspace to reduce allocation pressure and unnecessary recompositions during high-frequency events like typing.

  1. Modifier Memoization: Wrapped the top-level Modifier chain in ChatWorkspaceScreen in a remember block, avoiding the re-creation of multiple modifier objects on every keystroke.
  2. State Memoization: Used remember(query) for the isSendEnabled check to ensure the boolean calculation only occurs when the text changes and to allow the Button to skip recomposition when its state remains the same.

Added explanatory comments to the code and updated the performance journal in .agents/journal/bolt-journal.md.


PR created automatically by Jules for task 12071071982286545964 started by @yacosta738

- Memoize top-level Modifier chain in ChatWorkspaceScreen to reduce object allocations during typing.
- Use remember(query) for isSendEnabled check to skip redundant calculations and button recompositions.
- Add explanatory comments to optimized code paths.
- Update bolt-journal.md with implementation details and impact analysis.

Co-authored-by: yacosta738 <33158051+yacosta738@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 18, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

Latest commit: f4ebe0e
Status: ✅  Deploy successful!
Preview URL: https://6cff1342.corvus-42x.pages.dev
Branch Preview URL: https://perf-optimize-compose-ui-120.corvus-42x.pages.dev

View logs

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8faf11da-e3bf-489f-9ff5-4d46dac1e310

📥 Commits

Reviewing files that changed from the base of the PR and between 06eeec2 and f4ebe0e.

📒 Files selected for processing (2)
  • .agents/journal/bolt-journal.md
  • clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatWorkspace.kt
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pr-checks
  • GitHub Check: sonar
  • GitHub Check: pr-checks
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (2)
**/*.kt

⚙️ CodeRabbit configuration file

**/*.kt: Enforce null safety (no !!), structured concurrency, and non-blocking suspend code.
Prefer idiomatic Kotlin (expression bodies, sealed types, value classes when justified).
Verify tests follow TDD intent and use backtick test names where applicable.

Files:

  • clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatWorkspace.kt
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatWorkspace.kt
🧠 Learnings (1)
📚 Learning: 2026-02-21T09:07:52.298Z
Learnt from: yacosta738
Repo: dallay/corvus PR: 62
File: .agents/journal/sentinnel-journal.md:1-1
Timestamp: 2026-02-21T09:07:52.298Z
Learning: Branding guideline: The intentional brand name for the security-first agent in the dallay/corvus repository is 'Sentinnel' (with double n). Do not treat it as a typo of 'Sentinel'. Ensure all agent-related docs and journals under .agents/journal consistently use 'Sentinnel' with double n.

Applied to files:

  • .agents/journal/bolt-journal.md
🔇 Additional comments (3)
.agents/journal/bolt-journal.md (1)

15-31: LGTM!

The changelog entry accurately documents the performance optimizations with clear problem statements, solutions, and expected impact. Good practice to note that these are runtime optimizations rather than build-time improvements.

clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatWorkspace.kt (2)

193-200: LGTM!

Correct memoization with appropriate keys (modifier, colors.background). Theme changes will invalidate the cache, and the parent modifier parameter is properly tracked.


299-304: LGTM!

Valid optimization. While remember(query) still recalculates on each keystroke, the stable boolean result enables Compose's smart recomposition to skip the Button when enabled doesn't change—which is the majority of keystrokes (only blank↔non-blank transitions matter).


📝 Walkthrough

Summary by CodeRabbit

  • Performance Improvements
    • Optimized chat composition interface for faster, more responsive typing experience
    • Send button now responds quicker during message composition
    • Overall improved smoothness and reduced latency in chat interactions

Walkthrough

Adds changelog entry and implements Compose UI performance optimizations by memoizing the Send button's enable state computation and caching modifier allocations in ChatWorkspaceScreen to reduce recompositions and main-thread work during chat composition.

Changes

Cohort / File(s) Summary
Documentation
.agents/journal/bolt-journal.md
Changelog entry documenting runtime UI optimizations for chat composition, including remember usage and expected performance impacts.
Compose UI Optimizations
clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatWorkspace.kt
Memoizes isSendEnabled computation with remember(query) and wraps screenModifier in remember to prevent repeated allocations and recompositions during typing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

area:kotlin, risk:performance, area:docs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commit style with 'perf' prefix, uses imperative mood, stays under 72 characters (53 chars), and clearly describes the performance optimization changes.
Description check ✅ Passed The description includes a clear summary of changes, explains the optimizations with specific implementation details, and documents the updates made. All critical sections are present and complete.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 perf/optimize-compose-ui-12071071982286545964
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 89% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 9 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3064 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 421 >= 0
Merger Diversity Unique maintainers who merged PRs 2 >= 0
Repo History Merge Rate Merge rate in this repo 90% >= 0%
Repo History Min PRs Previous PRs in this repo 157 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-03-18 to 2026-03-18

@sentry
Copy link
Copy Markdown

sentry Bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yacosta738 yacosta738 marked this pull request as ready for review March 18, 2026 16:35
@sonarqubecloud
Copy link
Copy Markdown

@yacosta738 yacosta738 merged commit 3dfbad3 into main Mar 18, 2026
15 checks passed
@yacosta738 yacosta738 deleted the perf/optimize-compose-ui-12071071982286545964 branch March 18, 2026 16:54
@yacosta738 yacosta738 mentioned this pull request Mar 18, 2026
This was referenced Apr 19, 2026
This was referenced Apr 29, 2026
@dallay-bot dallay-bot Bot mentioned this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants