fix: bug in storage selector from side panel (#265)

This commit is contained in:
Nikhil
2026-01-21 16:52:57 -08:00
committed by GitHub
parent 49f603a3a6
commit 1fdc0c1b9e
5 changed files with 14 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
"root": false,
"extends": "//",
"vcs": {

View File

@@ -146,7 +146,6 @@ export const NewTab = () => {
query: searchQuery,
mode: 'agent',
action,
workingDir: selectedFolder?.path,
})
break
}
@@ -164,7 +163,6 @@ export const NewTab = () => {
query: item.message,
mode: item.mode,
action,
workingDir: selectedFolder?.path,
})
break
}

View File

@@ -22,6 +22,7 @@ import { formatConversationHistory } from '@/lib/conversations/formatConversatio
import { useLlmProviders } from '@/lib/llm-providers/useLlmProviders'
import { track } from '@/lib/metrics/track'
import { searchActionsStorage } from '@/lib/search-actions/searchActionsStorage'
import { selectedWorkspaceStorage } from '@/lib/workspace/workspace-storage'
import type { ChatMode } from './chatTypes'
import { useChatRefs } from './useChatRefs'
import { useNotifyActiveTab } from './useNotifyActiveTab'
@@ -142,6 +143,17 @@ export const useChatSession = () => {
const workingDirRef = useRef<string | undefined>(undefined)
const messagesRef = useRef<UIMessage[]>([])
useEffect(() => {
selectedWorkspaceStorage.getValue().then((folder) => {
workingDirRef.current = folder?.path
})
const unwatch = selectedWorkspaceStorage.watch((folder) => {
workingDirRef.current = folder?.path
})
return () => unwatch()
}, [])
useDeepCompareEffect(() => {
modeRef.current = mode
textToActionRef.current = textToAction
@@ -330,7 +342,6 @@ export const useChatSession = () => {
const unwatch = searchActionsStorage.watch((storageAction) => {
if (storageAction) {
setMode(storageAction.mode)
workingDirRef.current = storageAction.workingDir
sendMessage({ text: storageAction.query, action: storageAction.action })
}
})

View File

@@ -8,7 +8,6 @@ export interface SearchActionStorage {
query: string
mode: 'chat' | 'agent'
action?: ChatAction
workingDir?: string
}
/**

View File

@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",