fix(sessions): keep created-session scope through navigation and send (#10)
createSession now stamps the scope directory onto the returned session, and the create-session navigation passes that directory to the detail screen. Previously a freshly created home-scoped session was opened/addressed with the default (CWD) client because the route carried no directory param — the same scope mismatch class as #10, on the open/send path instead of the list path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -197,7 +197,12 @@ export const useSessions = create<SessionsState>((set, get) => ({
|
||||
const client = scopeDir ? connState.clientForDirectory(scopeDir) || connState.client : connState.client
|
||||
|
||||
try {
|
||||
const session = await client.session.create({ title })
|
||||
const created = await client.session.create({ title })
|
||||
// Stamp the scope we created in onto the session so every downstream path
|
||||
// (navigation params, selectSession, sendMessage's clientFor) addresses it
|
||||
// in the SAME scope. Without this, opening/sending to a freshly created
|
||||
// home-scoped session via the default client would hit the wrong scope (#10).
|
||||
const session = scopeDir && !created.directory ? { ...created, directory: scopeDir } : created
|
||||
// Don't optimistically add to sessions list — let loadSessions() handle it
|
||||
// to avoid duplicate key errors from race conditions
|
||||
set({
|
||||
|
||||
Reference in New Issue
Block a user