Skip to content

[UX] SettingsView shows stale mode/apiConfig in multi-tab mode #914

Description

@easonLiangWorldedtech

[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

  1. 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])
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions