fix: avoid stale project binding for new sessions
Keeps implicit new sessions tied to the current directory Prevents unmatched directories from inheriting the active project Adds regression coverage for draft project selection
This commit is contained in:
@@ -623,10 +623,9 @@ export const useSessionUIStore = create<SessionUIState>()((set, get) => ({
|
||||
const currentDirProject = resolveDraftProjectForDirectory(projects, availableWorktreesByProject, currentDirectory)
|
||||
|
||||
const selectedProject = (() => {
|
||||
if (explicitProject || explicitDirectory !== null) {
|
||||
return explicitProject ?? inferredProjectFromDir ?? fallbackProject
|
||||
}
|
||||
if (currentDirectory) return currentDirProject ?? fallbackProject
|
||||
if (explicitProject) return explicitProject
|
||||
if (explicitDirectory !== null) return inferredProjectFromDir
|
||||
if (currentDirectory) return currentDirProject
|
||||
return persistedProjectByDir ?? persistedProjectById ?? fallbackProject
|
||||
})()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user