Commit dda5c8c
committed
fix: resolve race condition in message editor
Fixes data loss when user sends message concurrently with tool response.
Problem:
When a tool response arrives (sendingDisabled=true) while user is typing,
clicking Send queues the message but immediately calls clearDraft(),
causing the input to be wiped before processing.
Solution:
- Remove clearDraft() call when message is queued (sendingDisabled path)
- Reduce autosave debounce from 300ms to 100ms
- Message remains visible until properly processed
Changes:
- webview-ui/src/components/chat/ChatView.tsx
- webview-ui/src/hooks/useAutosaveDraft.ts
- webview-ui/src/components/chat/__tests__/ChatView.raceCondition.spec.tsx
Tests: 10 unit tests covering bug reproduction, fix verification,
and autosave interaction (all passing)1 parent c944549 commit dda5c8c
File tree
4 files changed
+608
-7
lines changed- .changeset
- webview-ui/src
- components/chat
- __tests__
- hooks
4 files changed
+608
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
612 | | - | |
613 | | - | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
614 | 618 | | |
615 | 619 | | |
616 | 620 | | |
| |||
0 commit comments