feat(home): add double-enter to send top queued message#4005
feat(home): add double-enter to send top queued message#4005waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Implements priming state/timer management in Reviewed by Cursor Bugbot for commit ff5a601. Configure here. |
Greptile SummaryThis PR adds a Cursor-style "double-enter" shortcut: while the AI is streaming and there are queued messages, pressing Enter twice on an empty input sends the top queued message immediately. The first Enter primes the message (stored via a ref with a 3-second auto-clear timer), and the second Enter within that window triggers the send. Typing any content dismisses the primed state.
Confidence Score: 5/5Safe to merge — only P2 UX/consistency findings remain Both findings are P2: a small window where the primed state may linger after an @-mention interaction, and the absence of visual feedback for the primed state. Neither causes data loss, an incorrect send, or a broken user flow. The core logic — ref-based state, timer cleanup, Enter interception, and stable ref wrappers — is sound and follows established codebase patterns. user-input.tsx has the minor onPrimedDismiss omission in the @-mention branch worth addressing in a follow-up; no correctness concerns in mothership-chat.tsx Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant UI as UserInput
participant MC as MothershipChat
participant Q as MessageQueue
Note over U,Q: isSending=true, queue non-empty
U->>UI: Press Enter (input empty)
UI->>MC: onEnterWhileEmpty()
MC->>Q: messageQueueRef.current[0]
MC-->>MC: primedQueueIdRef = topMessage.id
MC-->>MC: Start 3 s timer → clearPrimed
MC-->>UI: return true
UI-->>U: (no visual feedback)
alt Second Enter within 3 s
U->>UI: Press Enter (input still empty)
UI->>MC: onEnterWhileEmpty()
MC->>Q: messageQueueRef.current[0]
Note over MC: primedQueueIdRef === topMessage.id
MC-->>MC: clearPrimed()
MC->>Q: onSendQueuedMessage(topMessage.id)
MC-->>UI: return true
else User types content
U->>UI: Keystroke → handleInputChange
UI->>MC: onPrimedDismiss()
MC-->>MC: clearPrimed() — timer cancelled
else 3 s elapses
MC-->>MC: clearPrimed() fires automatically
end
|
Summary
Type of Change
Testing
Tested manually
Checklist