fix: use directory-aware client for delete, rename, command, permissions, questions
- sessions.ts: deleteSession looks up session.directory and uses clientFor() instead of bare client, so cross-project deletes hit the right server path - index.tsx: submitRename uses clientForDirectory(session.directory) so renames work for sessions not owned by the active project directory - index.tsx: handleSwitchDirectory calls catalog.load() after a directory switch so agents/commands/providers refresh for the new project - session/[id].tsx: introduce sessionClient (directory-aware) and use it in handlePermissionReply, handleQuestionReply, handleQuestionReject, slash-command send, and the refreshPending bootstrap call; also add 'directory' to useEffect deps - catalog.ts: remove debug console.log
This commit is contained in:
committed by
Dennis V
parent
ce598e2a52
commit
0ef3dd37b6
@@ -18,6 +18,7 @@ import { router, useFocusEffect } from "expo-router"
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import { useSessions } from "../../src/stores/sessions"
|
||||
import { useConnections } from "../../src/stores/connections"
|
||||
import { useCatalog } from "../../src/stores/catalog"
|
||||
import type BottomSheet from "@gorhom/bottom-sheet"
|
||||
import type { Session } from "../../src/lib/sdk"
|
||||
import { DirectorySwitcher } from "../../src/components/chat"
|
||||
@@ -123,6 +124,7 @@ export default function SessionsScreen() {
|
||||
addRecentDirectory,
|
||||
recentDirectories,
|
||||
} = useConnections()
|
||||
const loadCatalog = useCatalog((s) => s.load)
|
||||
const dirSheetRef = useRef<BottomSheet>(null)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
@@ -131,8 +133,9 @@ export default function SessionsScreen() {
|
||||
await switchDirectory(dir)
|
||||
loadSessions()
|
||||
refreshProject()
|
||||
loadCatalog()
|
||||
},
|
||||
[switchDirectory, loadSessions, refreshProject],
|
||||
[switchDirectory, loadSessions, refreshProject, loadCatalog],
|
||||
)
|
||||
|
||||
useFocusEffect(
|
||||
@@ -157,12 +160,14 @@ export default function SessionsScreen() {
|
||||
|
||||
const submitRename = useCallback(async () => {
|
||||
const title = renameText.trim()
|
||||
if (!title || !renaming || !client) return
|
||||
await client.session.update(renaming.id, { title })
|
||||
if (!title || !renaming) return
|
||||
const renameClient = renaming.directory ? (clientForDirectory(renaming.directory) ?? client) : client
|
||||
if (!renameClient) return
|
||||
await renameClient.session.update(renaming.id, { title })
|
||||
setRenaming(null)
|
||||
setRenameText("")
|
||||
loadSessions()
|
||||
}, [renaming, renameText, client, loadSessions])
|
||||
}, [renaming, renameText, client, clientForDirectory, loadSessions])
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(session: Session) => {
|
||||
|
||||
Reference in New Issue
Block a user