fix(session): prevent listing non-existent worktree directory
This commit is contained in:
@@ -273,7 +273,14 @@ export const useSessionStore = create<SessionStore>()(
|
|||||||
const worktreeRoot = `${normalizedProject}/${WORKTREE_ROOT}`;
|
const worktreeRoot = `${normalizedProject}/${WORKTREE_ROOT}`;
|
||||||
try {
|
try {
|
||||||
const candidates = new Set<string>();
|
const candidates = new Set<string>();
|
||||||
if (worktreeRoot) {
|
|
||||||
|
// Check if .openchamber directory exists before trying to list it
|
||||||
|
const projectEntries = await opencodeClient.listLocalDirectory(normalizedProject);
|
||||||
|
const worktreeDirExists = projectEntries.some(
|
||||||
|
(entry) => entry.isDirectory && entry.name === WORKTREE_ROOT
|
||||||
|
);
|
||||||
|
|
||||||
|
if (worktreeDirExists) {
|
||||||
const entries = await opencodeClient.listLocalDirectory(worktreeRoot);
|
const entries = await opencodeClient.listLocalDirectory(worktreeRoot);
|
||||||
entries
|
entries
|
||||||
.filter((entry) => entry.isDirectory)
|
.filter((entry) => entry.isDirectory)
|
||||||
|
|||||||
Reference in New Issue
Block a user