Commit 72eb0ff
authored
🤖 fix: show user messages immediately without deferral (#1041)
## Summary
Fixes a UX issue where there was an occasional delay between sending a
message and it appearing in the chat window. During this delay, the
input was cleared but the user message wasn't visible anywhere.
### Root Cause
`useDeferredValue` (added in #1004 to improve streaming performance) was
deferring **all** message list updates, including new user messages.
This is correct for streaming deltas (where rapid updates benefit from
deferral) but wrong for user-initiated messages (where immediate
feedback is expected).
### Fix
Compare the message counts between the current and deferred values:
- **Count differs** (new message added) → Show immediately
- **Count same** (content changes in existing messages) → Defer for
performance
This preserves the streaming optimization while ensuring user messages
appear instantly.
### Testing
- `make static-check` ✅
- `make test` on WorkspaceStore ✅
_Generated with `mux`_1 parent e889d20 commit 72eb0ff
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
| |||
0 commit comments