Commit dbd7836
authored
🤖 Fix intermittent Cmd+Shift+T keybind failure (#254)
## Problem
The Cmd+Shift+T keybind for toggling thinking would fail in new chats
(before any messages were sent). User would press the key and nothing
would happen, even though they could see a model selected in the UI.
**Root cause**: State source mismatch between what the user sees and
what the keybind checks:
- **UI shows**: `selectedModel` from localStorage (always available,
shown in bottom-left selector)
- **Keybind checked**: `currentModel` from message history (null until
first message sent)
User sees "opus" selected, presses Cmd+Shift+T, nothing happens because
the keybind was checking message history instead of the selected model.
## Solution
Read the selected model from localStorage (using
`getModelKey(workspaceId)`) and fall back to message history model if
not set:
```typescript
const selectedModel = readPersistedState<string | null>(getModelKey(workspaceId), null);
const modelToUse = selectedModel ?? currentModel;
```
This matches what the user sees in the UI, so the keybind now works
immediately in new chats.
## Testing
- ✅ All 502 unit tests pass
- ✅ TypeScript compilation passes
- ✅ Lint and format checks pass
- 🧪 Manual testing: Open new workspace, verify Cmd+Shift+T toggles
thinking before sending first message
## Changes
- **Net change**: +5 lines (adds localStorage read, updates comments)
- **Behavior**: Keybind now works in new chats (matches user's mental
model)
- **Fallback**: Still uses message history model if localStorage is
empty (graceful degradation)
_Generated with `cmux`_1 parent 8e4c425 commit dbd7836
1 file changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | | - | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
0 commit comments