Commit 5d17f56
authored
feat: add lock toggle to pin API config across all modes in workspace (#11295)
* feat: add lock toggle to pin API config across all modes in workspace
Add a lock/unlock toggle inside the API config selector popover (next to
the settings gear) that, when enabled, applies the selected API
configuration to all modes in the current workspace.
- Add lockApiConfigAcrossModes to ExtensionState and WebviewMessage types
- Store setting in workspaceState (per-workspace, not global)
- When locked, activateProviderProfile sets config for all modes
- Lock icon in ApiConfigSelector popover bottom bar next to gear
- Full i18n: English + 17 locale translations (all mention workspace scope)
- 9 new tests: 2 ClineProvider, 2 handler, 5 UI (77 total pass)
* refactor: replace write-fan-out with read-time override for lock API config
The original lock implementation used setModeConfig() fan-out to write the
locked config to ALL modes globally. Since the lock flag lives in workspace-
scoped workspaceState but modeApiConfigs are in global secrets, this caused
cross-workspace data destruction.
Replaced with read-time guards:
- handleModeSwitch: early return when lock is on (skip per-mode config load)
- createTaskWithHistoryItem: skip mode-based config restoration under lock
- activateProviderProfile: removed fan-out block
- lockApiConfigAcrossModes handler: simplified to flag + state post only
- Fixed pre-existing workspaceState mock gap in ClineProvider.spec.ts and
ClineProvider.sticky-profile.spec.ts1 parent 6826e20 commit 5d17f56
34 files changed
Lines changed: 732 additions & 4 deletions
File tree
- packages/types/src
- src/core/webview
- __tests__
- webview-ui/src
- components/chat
- __tests__
- context
- i18n/locales
- ca
- de
- en
- es
- fr
- hi
- id
- it
- ja
- ko
- nl
- pl
- pt-BR
- ru
- tr
- vi
- zh-CN
- zh-TW
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| |||
524 | 525 | | |
525 | 526 | | |
526 | 527 | | |
| 528 | + | |
527 | 529 | | |
528 | 530 | | |
529 | 531 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
902 | | - | |
| 902 | + | |
| 903 | + | |
903 | 904 | | |
904 | 905 | | |
905 | 906 | | |
| |||
1316 | 1317 | | |
1317 | 1318 | | |
1318 | 1319 | | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
1319 | 1327 | | |
1320 | 1328 | | |
1321 | 1329 | | |
| |||
2081 | 2089 | | |
2082 | 2090 | | |
2083 | 2091 | | |
| 2092 | + | |
2084 | 2093 | | |
2085 | 2094 | | |
2086 | 2095 | | |
| |||
2229 | 2238 | | |
2230 | 2239 | | |
2231 | 2240 | | |
| 2241 | + | |
2232 | 2242 | | |
2233 | 2243 | | |
2234 | 2244 | | |
| |||
2464 | 2474 | | |
2465 | 2475 | | |
2466 | 2476 | | |
| 2477 | + | |
2467 | 2478 | | |
2468 | 2479 | | |
2469 | 2480 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
| |||
0 commit comments