fix: custom-dir session create used user input not server directory (scope drift)

onCreateInDirectory navigated with dir.trim() (raw user input) while the
sibling create paths use the server-authoritative session.directory. When
the opencode server normalizes the path (trailing slash/symlink/relative),
the nav param diverged from the session's real scope, causing the new
session/[id] screen to scope to the wrong client -> 'Failed to load
session'. Mirror the sibling paths' session.directory spread.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
engineer
2026-06-02 01:52:04 -07:00
parent 61cbb35bf3
commit ee7082a72a

View File

@@ -215,7 +215,10 @@ export default function SessionsScreen() {
setShowNewSession(false)
setCustomDir("")
if (session) {
router.push({ pathname: `/session/[id]`, params: { id: session.id, directory: dir.trim() } })
router.push({
pathname: `/session/[id]`,
params: { id: session.id, ...(session.directory ? { directory: session.directory } : {}) },
})
}
} catch (error) {
console.error("Failed to create session in directory:", error)