Repository navigation
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
Walkthrough
🚥 Pre-merge checks | ✅ 3 | ❌ 2
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
mobile/src/session/MobileNativeChatComposer.test.ts (2)
140-155: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the disabled state separately from whitespace-only input.
This test covers only a whitespace draft. The PR objective also requires hardware Enter to remain blocked when
disabledis true. Add a non-empty draft withdisabled: trueand assert thatonSendis not called.Suggested test addition
+ it('does not send hardware Enter when disabled', async () => { + const onSend = vi.fn().mockResolvedValue(true) + await act(async () => { + renderer = create( + createElement(MobileNativeChatComposer, { + value: 'hello', + onChangeText: vi.fn(), + onSend, + disabled: true + }) + ) + }) + + await act(async () => composerInput().props.onKeyPress?.({ nativeEvent: { key: 'Enter' } })) + + expect(onSend).not.toHaveBeenCalled() + })
80-138: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftAdd native coverage for
TextInputkey delivery.These tests run with a mocked
TextInputand invokeonKeyPressdirectly. They coverhandleKeyPress, but not the documented React Native event contract. Add native or adapter-level coverage for Android hardware Enter, soft Return, Shift+Enter, and IME composition. React Native 0.83 documents onlynativeEvent.keyand does not dispatch Android hardware-keyboard input throughonKeyPress.Source: MCP tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 84832541-9a1b-41b7-9fed-5d983761d7d2
📥 Commits
Reviewing files that changed from the base of the PR and between c0a7754 and 294042a3cc217caa28bb987ff5af5d691b8f8697.
📒 Files selected for processing (2)
mobile/src/session/MobileNativeChatComposer.test.tsmobile/src/session/MobileNativeChatComposer.tsx
294042a to
86e29a4
Compare
|
Follow-up for the CodeRabbit notes:
Out of scope: a native hardware-keyboard / IME adapter. React Native 0.83 Validation: |
86e29a4 to
1ad2bb2
Compare
1ad2bb2 to
6cdd44c
Compare
[Medium impact] Adds hardware Enter key handling to the chat composer. The native event handling should be corrected before merge because Shift+Enter or IME confirmation can submit text when the platform does not provide the assumed event fields. Findings
SummaryThe PR routes Enter key events from the mobile native-chat multiline composer through the existing send path while attempting to preserve Shift+Enter and IME behavior.
Reviews (1) · Last reviewed commit: "test(mobile): type hardware Enter helper..." · Reviewed by Greptile |
| const handleKeyPress = (event: { | ||
| nativeEvent: { key: string; shiftKey?: boolean; isComposing?: boolean } | ||
| }): void => { | ||
| const { key, shiftKey, isComposing } = event.nativeEvent | ||
| // Why: IME Enter confirms composition; submitting would send a partial draft. | ||
| if (key !== 'Enter' || shiftKey || isComposing || !canSend) { |
There was a problem hiding this comment.
Native modifiers are not preserved
When native onKeyPress omits the optional shiftKey or isComposing fields, the new handler treats Shift+Enter or IME-confirming Enter as an ordinary Enter and calls handleSend(), causing multiline or partially composed text to be submitted unexpectedly.
Knowledge Base Used: Mobile sessions and terminal interaction
Hardware Enter/Return in the mobile Native Chat composer now calls the existing handleSend() path. Multiline stays on so Shift+Enter and the soft-keyboard return can still insert a newline. IME composition Enter does not submit. Fixes stablyai#14744
Hardware Enter still sends through handleSend. The follow-up TextInput newline is suppressed at the active selection, not only at value + \\n.
The composer now requires a send surface, and the selection callback has to stay visible on the input helper after the field moved.
6cdd44c to
a22952f
Compare
Description
Hardware Enter/Return in mobile Native Chat now sends the message.
Shift+Enter still inserts a newline.
Focused fix
handleSend().Preserves
Evidence
cd mobile && pnpm exec vitest run src/session/MobileNativeChatComposer.test.tsFixes #14744