Skip to content

Fix chat composer: enable send without a session, grow input, left-align title - #9

Merged
MRL-00 merged 1 commit into
mainfrom
claude/pi-mobile-messaging-bugs-24rj8o
Jul 22, 2026
Merged

MRL-00 merged 1 commit into
mainfrom
claude/pi-mobile-messaging-bugs-24rj8o

Conversation

@MRL-00

@MRL-00 MRL-00 commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

Fixes three messaging UI bugs in ChatView:

  1. Send button never enabled — canSend required an existing chat session, but a workspace with no chats has none, so the button stayed disabled forever. Sending now works with just text in the field; a session is created automatically on first send (and the draft is restored if creation fails).
  2. Composer didn't grow while typing — the text field now expands vertically up to 5 lines (axis: .vertical, lineLimit(1...5)) instead of pushing text off-screen horizontally.
  3. Branch name misaligned in nav bar — the title stack now uses leading alignment so the branch (e.g. main) sits flush under the workspace name.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QgZomS1NFK9xx5dbtvzLQJ


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added multiline message composition with a limited number of visible lines.
    • New chats can now be started directly when sending the first message.
    • Updated the chat navigation title for improved alignment.
  • Improvements

    • Sending is enabled based on message content and streaming status, without requiring an existing chat session.

…ign title

- Send button never enabled in workspaces with no existing chat session;
  create a session on first send instead of requiring one up front
- Composer text field now grows vertically (1-5 lines) instead of
  scrolling text off-screen horizontally
- Left-align the branch name under the workspace title in the nav bar

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QgZomS1NFK9xx5dbtvzLQJ
@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

ChatView now uses a leading-aligned navigation title, supports multiline drafts of up to five lines, and permits sending without a pre-existing session. The first send creates a session when needed and restores draft state if session creation fails.

Changes

ChatView behavior

Layer / File(s) Summary
Composer presentation
PiMobile/Views/ChatView.swift
The navigation title is leading-aligned, and the composer accepts one to five lines of vertical text input.
Initial message sending
PiMobile/Views/ChatView.swift
Sending depends on draft content and streaming state rather than an existing session, creating a session during the first send and restoring state when creation fails.

Estimated code review effort: 2 (Simple) | ~10 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 accurately summarizes the main UI and sending behavior changes: sessionless send, multiline composer growth, and left-aligned title.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 claude/pi-mobile-messaging-bugs-24rj8o

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.

@MRL-00
MRL-00 merged commit 15e99f1 into main Jul 22, 2026
1 check was pending

@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: 2

🤖 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 `@PiMobile/Views/ChatView.swift`:
- Line 166: Update the canSend validation and the draft validation at the
submission site around Line 224 to trim using .whitespacesAndNewlines, ensuring
drafts containing only spaces or line breaks are rejected before enabling or
submitting.
- Around line 227-240: Update the send flow in ChatView’s Task around api.send
to handle failures explicitly instead of discarding them: catch the send error,
set running = false, restore draft from the original text, and use any existing
user-visible failure feedback mechanism. Preserve the successful-send behavior
and session creation flow.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8600cad1-3a11-4630-9aee-e918168103a0

📥 Commits

Reviewing files that changed from the base of the PR and between f0f6638 and 6bfb84c.

📒 Files selected for processing (1)
  • PiMobile/Views/ChatView.swift

}

private var canSend: Bool { !draft.trimmingCharacters(in: .whitespaces).isEmpty && !running && sessionId != nil }
private var canSend: Bool { !draft.trimmingCharacters(in: .whitespaces).isEmpty && !running }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject newline-only drafts.

A vertical TextField can contain only line breaks, but .whitespaces does not trim them. The send button becomes enabled and Line 224 submits an effectively blank message. Use .whitespacesAndNewline in both locations.

Also applies to: 224-224

🤖 Prompt for 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.

In `@PiMobile/Views/ChatView.swift` at line 166, Update the canSend validation and
the draft validation at the submission site around Line 224 to trim using
.whitespacesAndNewlines, ensuring drafts containing only spaces or line breaks
are rejected before enabling or submitting.

Comment on lines 227 to +240
Task {
try? await api.send(sessionId: sessionId, text: text, model: model)
// A workspace with no chats yet has no session — create one on first send.
var sid = sessionId
if sid == nil, let s = try? await api.createSession(workspaceId: workspace.id) {
sessions.insert(s, at: 0)
session = s
sid = s.id
}
guard let sid else {
running = false
draft = text
return
}
try? await api.send(sessionId: sid, text: text, model: model)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore the draft when sending fails.

try? await api.send(...) discards errors after clearing draft; a network/API failure permanently loses the message. Handle the error, set running = false, and restore the draft (with user-visible failure feedback if available).

Proposed fix
-            try? await api.send(sessionId: sid, text: text, model: model)
+            do {
+                try await api.send(sessionId: sid, text: text, model: model)
+            } catch {
+                running = false
+                draft = text
+                return
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Task {
try? await api.send(sessionId: sessionId, text: text, model: model)
// A workspace with no chats yet has no session — create one on first send.
var sid = sessionId
if sid == nil, let s = try? await api.createSession(workspaceId: workspace.id) {
sessions.insert(s, at: 0)
session = s
sid = s.id
}
guard let sid else {
running = false
draft = text
return
}
try? await api.send(sessionId: sid, text: text, model: model)
Task {
// A workspace with no chats yet has no session — create one on first send.
var sid = sessionId
if sid == nil, let s = try? await api.createSession(workspaceId: workspace.id) {
sessions.insert(s, at: 0)
session = s
sid = s.id
}
guard let sid else {
running = false
draft = text
return
}
do {
try await api.send(sessionId: sid, text: text, model: model)
} catch {
running = false
draft = text
return
}
🤖 Prompt for 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.

In `@PiMobile/Views/ChatView.swift` around lines 227 - 240, Update the send flow
in ChatView’s Task around api.send to handle failures explicitly instead of
discarding them: catch the send error, set running = false, restore draft from
the original text, and use any existing user-visible failure feedback mechanism.
Preserve the successful-send behavior and session creation flow.

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