fix(mothership): clear chat input after sending a message mid-conversation#4936
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview In Autofill-style adoption is unchanged whenever the input already has content in state. Reviewed by Cursor Bugbot for commit f3439af. Configure here. |
Greptile SummaryThis PR fixes a bug where the Mothership chat input failed to clear after sending a message mid-conversation. The stale-text resurrection was caused by
Confidence Score: 5/5Safe to merge — a one-line guard on an edge case with clear, well-reasoned justification and no regressions to autofill or paste paths. The change is a single targeted condition added to the DOM-adoption fast-path in No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant DOM as textarea DOM
participant Handler as handleSubmit
participant Ref as valueRef
participant Adopt as handleSelectAdjust (adoptDomValue)
User->>Handler: press Enter / click Send
Handler->>Ref: "valueRef.current = ''"
Handler->>DOM: setValue('') → controlled re-render scheduled
Note over DOM: DOM still holds "sent text" until re-render
DOM-->>Adopt: select / mouseUp fires (before re-render)
Note over Adopt: OLD: textarea.value ≠ valueRef.current ('') → adoptDomValue() resurrects text ❌
Note over Adopt: NEW: valueRef.current === '' → skip adoption ✅
DOM->>DOM: React re-render sets textarea value to ''
Reviews (1): Last reviewed commit: "fix(mothership): clear chat input after ..." | Re-trigger Greptile |
Summary
handleSelectAdjustDOM-drift adoption (added in mothership v0.2,#4923) re-adopted the stale textarea DOM value back into React state. After submit clearsvalueto''synchronously, aselect/mouseUpcan fire while the controlled textarea still holds the just-sent text, so it got resurrected.Type of Change
Testing
Tested manually — sending messages mid-conversation now clears the input every time; mention/skill chipification and paste behavior unchanged.
Checklist