fix/mobile PMs#154
Conversation
📝 WalkthroughWalkthroughBumps package to 0.2.5 and adds mobile build scripts; clamps and syncs mobile column state when member page is absent; optional-chains reply IDs in message sending; allows navigation when re-selecting chat in narrow view; blurs active element when closing empty search; gates reply actions by message.type === "message". Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
|
Automated deployment preview for the PR in the Cloudflare Pages. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/layout/AppLayout.tsx`:
- Around line 124-133: currentPageIndex can momentarily point past the available
pages when hasMemberPage flips false, causing a blank swipe page; clamp or
recompute it against the current totalPages instead of relying solely on
getPageIndex(mobileViewActiveColumn). Replace the plain assignment to
currentPageIndex with a safe value (e.g., let totalPages = hasMemberPage ? 3 :
2; const currentPageIndex = Math.min(getPageIndex(mobileViewActiveColumn),
totalPages - 1)) so the index never exceeds available pages, and apply the same
clamped logic to the other occurrence that uses
getPageIndex/mobileViewActiveColumn (the block around the second instance noted
in the review).
In `@src/hooks/useMessageSending.ts`:
- Around line 438-439: Stop generating a UUID into msgid for optimistic local
PMs: leave msgid undefined until the server returns the real IRC message ID (use
the existing id for local identity/optimistic dedupe), and if you need a
separate client-only correlation identifier introduce a new field (e.g.,
clientMsgId) instead of reusing msgid; update any codepaths that serialize
localReplyTo.msgid into reply tags (references to localReplyTo.msgid) to only
emit server-provided msgid, and if you want the client-only id to participate in
dedupe add it to processedMessageIds logic rather than overwriting msgid.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2afcba6a-9576-4cc2-8631-86ccddea62f5
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
package.jsonsrc/components/layout/AppLayout.tsxsrc/hooks/useMessageSending.tssrc/store/index.ts
cc2821f to
37ceade
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/message/MessageItem.tsx (1)
893-900:⚠️ Potential issue | 🟠 MajorDon't enable mobile reply on messages that lack a server
msgid.
Message.msgidis optional, and the PM send path now creates optimistic local messages without one insrc/hooks/useMessageSending.tsLines 437-448. Since every send path only serializes@+draft/replywhenlocalReplyTo?.msgidexists insrc/hooks/useMessageSending.tsLines 205-207, 308-310, and 376-377, this swipe affordance accepts replies that cannot be represented on the wire.If local-only replies are intentional, they need a separate client-side flow instead of reusing the protocol reply action.🛠️ Minimal fix
- canReply={message.type === "message"} + canReply={message.type === "message" && !!message.msgid}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/message/MessageItem.tsx` around lines 893 - 900, The swipe reply is being enabled for optimistic/local messages that lack a server Message.msgid, causing replies that cannot be serialized/represented on the wire; update the SwipeableMessage usage so reply is only enabled for messages with a server id (e.g., change canReply to message.type === "message" && !!message.msgid) and also guard the onReply handler (setReplyTo) to no-op unless message.msgid exists, referencing SwipeableMessage, setReplyTo, onReply, and Message.msgid (see useMessageSending.ts where localReplyTo?.msgid is checked).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/components/message/MessageItem.tsx`:
- Around line 893-900: The swipe reply is being enabled for optimistic/local
messages that lack a server Message.msgid, causing replies that cannot be
serialized/represented on the wire; update the SwipeableMessage usage so reply
is only enabled for messages with a server id (e.g., change canReply to
message.type === "message" && !!message.msgid) and also guard the onReply
handler (setReplyTo) to no-op unless message.msgid exists, referencing
SwipeableMessage, setReplyTo, onReply, and Message.msgid (see
useMessageSending.ts where localReplyTo?.msgid is checked).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a1a4f8c4-6201-44ed-bccc-cd05b18b9b8f
⛔ Files ignored due to path filters (3)
src-tauri/gen/apple/ObsidianIRC.xcodeproj/project.pbxprojis excluded by!**/gen/**src-tauri/gen/apple/ObsidianIRC_iOS/Info.plistis excluded by!**/gen/**src-tauri/gen/apple/ObsidianIRC_iOS/ObsidianIRC_iOS.entitlementsis excluded by!**/gen/**
📒 Files selected for processing (4)
package.jsonsrc/components/layout/AppLayout.tsxsrc/components/message/MessageItem.tsxsrc/hooks/useMessageSending.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/message/MessageActions.tsx (1)
11-20: Consider aligning WhisperMessage.tsx with the newcanReplysemantics.The new
canReplyprop is a good addition for explicit control. However, there's a semantic inconsistency:
- MessageItem.tsx now passes
canReply={message.type === "message"}(type-based gating)- WhisperMessage.tsx (see context snippet at lines 168-187) does not pass
canReply, so it falls back to the default!!message.msgid(msgid-based gating)This means whisper messages use different reply-gating logic than regular messages. If the intent is to uniformly gate replies by message type, WhisperMessage.tsx should also pass
canReply={message.type === "message"}.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/message/MessageActions.tsx` around lines 11 - 20, WhisperMessage.tsx currently relies on MessageActions' default canReply (based on message.msgid), creating inconsistent reply gating versus MessageItem.tsx which passes canReply={message.type === "message"}; update the JSX in WhisperMessage.tsx where <MessageActions ... /> is rendered to explicitly pass canReply={message.type === "message"} (and remove reliance on the default) so both WhisperMessage and MessageItem use the same type-based reply gating logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/message/MessageActions.tsx`:
- Around line 11-20: WhisperMessage.tsx currently relies on MessageActions'
default canReply (based on message.msgid), creating inconsistent reply gating
versus MessageItem.tsx which passes canReply={message.type === "message"};
update the JSX in WhisperMessage.tsx where <MessageActions ... /> is rendered to
explicitly pass canReply={message.type === "message"} (and remove reliance on
the default) so both WhisperMessage and MessageItem use the same type-based
reply gating logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 58215a41-3b1c-479c-a26c-e171392503df
📒 Files selected for processing (2)
src/components/message/MessageActions.tsxsrc/components/message/MessageItem.tsx
Summary by CodeRabbit
Bug Fixes
Improvements
New Features