fix: proper tab isolation with updateTabById
- Added updateTabById function to store for updating specific tabs by ID - Capture tab ID at request start (requestTabId) - All streaming updates now go to the captured tab ID, not activeTabId - Switching tabs during streaming no longer pollutes other tabs - Local UI state only updates if still on the same tab - Complete isolation: each tab's history/preview/agent is independent
This commit is contained in:
@@ -56,6 +56,7 @@ interface AppState {
|
||||
addAIAssistTab: (agent?: string) => void;
|
||||
removeAIAssistTab: (id: string) => void;
|
||||
updateActiveTab: (updates: Partial<AIAssistTab>) => void;
|
||||
updateTabById: (tabId: string, updates: Partial<AIAssistTab>) => void;
|
||||
|
||||
setLanguage: (lang: "en" | "ru" | "he") => void;
|
||||
setSelectedProvider: (provider: ModelProvider) => void;
|
||||
@@ -149,6 +150,11 @@ const useStore = create<AppState>((set) => ({
|
||||
t.id === state.activeTabId ? { ...t, ...updates } : t
|
||||
)
|
||||
})),
|
||||
updateTabById: (tabId, updates) => set((state) => ({
|
||||
aiAssistTabs: state.aiAssistTabs.map(t =>
|
||||
t.id === tabId ? { ...t, ...updates } : t
|
||||
)
|
||||
})),
|
||||
|
||||
setLanguage: (lang) => set({ language: lang }),
|
||||
setSelectedProvider: (provider) => set({ selectedProvider: provider }),
|
||||
|
||||
Reference in New Issue
Block a user