[UX] SettingsView shows stale mode/apiConfig in multi-tab mode
Problem
In parallel mode, SettingsView displays stale mode and apiConfiguration values because its internal cachedState is only updated when currentApiConfigName changes (via useEffect dependency), but NOT when mode changes via handleModeSwitch().
Evidence
Code locations:
Reproduction:
1. Open Tab A (sidebar) → set mode = "architect" via handleModeSwitch()
2. Open Tab B (editor) → open SettingsView
3. SettingsView displays mode = "code" (from global state), NOT "architect" (view-local)
4. Switching API config in Tab B updates cachedState, but switching mode does not
Root Cause
SettingsView.cachedState is initialized from extensionState (the React context value), which reflects the merged state at initialization time. When another tab changes its mode, the global state doesn't change (each tab has its own view-local override), so SettingsView in other tabs never sees the update.
Proposed Fix
-
Add mode to the useEffect dependency array that updates cachedState:
useEffect(() => {
if (prevApiConfigName.current === currentApiConfigName && prevMode.current === mode) return
setCachedState((prev) => ({ ...prev, ...extensionState }))
prevApiConfigName.current = currentApiConfigName
prevMode.current = mode
setChangeDetected(false)
}, [currentApiConfigName, mode, extensionState])
-
Alternatively: Pass viewId to webview so SettingsView can distinguish local vs global state and show a visual indicator when they differ.
Scope
- Impact: All multi-tab users — any tab with a different mode than the global default will see stale values in SettingsView
- Risk: Low — only affects UI display, not actual behavior
- Priority: High (directly impacts user trust in parallel mode)
Related
[UX] SettingsView shows stale mode/apiConfig in multi-tab mode
Problem
In parallel mode,
SettingsViewdisplays stalemodeandapiConfigurationvalues because its internalcachedStateis only updated whencurrentApiConfigNamechanges (viauseEffectdependency), but NOT whenmodechanges viahandleModeSwitch().Evidence
Code locations:
SettingsView.tsx:153:const [cachedState, setCachedState] = useState(() => extensionState)— initialized once from contextSettingsView.tsx:222-232:useEffectonly watchescurrentApiConfigName, notmodeClineProvider.ts:1640:handleModeSwitch()updates view-local state but doesn't trigger SettingsView cache refreshReproduction:
Root Cause
SettingsView.cachedStateis initialized fromextensionState(the React context value), which reflects the merged state at initialization time. When another tab changes itsmode, the global state doesn't change (each tab has its own view-local override), so SettingsView in other tabs never sees the update.Proposed Fix
Add
modeto theuseEffectdependency array that updatescachedState:Alternatively: Pass
viewIdto webview so SettingsView can distinguish local vs global state and show a visual indicator when they differ.Scope
Related